Hello
Could you please help for a simple boolean expression
If a is not equal to Null
I tried
If (a != null) Then
This expression does not work
I look at Help but can not find out
Could you please help
Thanks
S.Hoa 9 4155
> Could you please help for a simple boolean expression If a is not equal to Null I tried If (a != null) Then
From my point of view it seems that you are trying
to check whether object exists.
Try:
If Not (a Is Nothing) Then
--
Pozdrav,
Josip Medved, MCSD http://www.jmedved.com
What sort of "Null" are you looking for?
Database Null?
Object is Nothing?
a <> 0&?
"HS1" <so*@slingshot. co.nz> wrote in message
news:1098135675 .785296@ftpsrv1 ... Hello
Could you please help for a simple boolean expression
If a is not equal to Null
I tried
If (a != null) Then
This expression does not work
I look at Help but can not find out
Could you please help
Thanks S.Hoa
Thank you
a is a value of a field in a table of a database. I have to check it is null
or not
I have a solution
If Not (a is DBNull.Value) Then
"Gerald Hernandez" <Cablewizard@sp *********@Yahoo .com> wrote in message
news:OI******** ******@TK2MSFTN GP09.phx.gbl... What sort of "Null" are you looking for? Database Null? Object is Nothing? a <> 0&?
"HS1" <so*@slingshot. co.nz> wrote in message news:1098135675 .785296@ftpsrv1 ... Hello
Could you please help for a simple boolean expression
If a is not equal to Null
I tried
If (a != null) Then
This expression does not work
I look at Help but can not find out
Could you please help
Thanks S.Hoa
you got it, mostly.
i'm not certain if the IS keyword will give you the proper results or not.
this is not a value comparison, but an Object Reference comparison.
it would be safer to use:
If Not (a = DBNull.Value) Then
or use the alternate test using
If Not IsDBNull(a) Then
Gerald
"HS1" <so*@slingshot. co.nz> wrote in message
news:1098141920 .570486@ftpsrv1 ... Thank you a is a value of a field in a table of a database. I have to check it is
null or not I have a solution
If Not (a is DBNull.Value) Then
"Gerald Hernandez" <Cablewizard@sp *********@Yahoo .com> wrote in message news:OI******** ******@TK2MSFTN GP09.phx.gbl... What sort of "Null" are you looking for? Database Null? Object is Nothing? a <> 0&?
"HS1" <so*@slingshot. co.nz> wrote in message news:1098135675 .785296@ftpsrv1 ... Hello
Could you please help for a simple boolean expression
If a is not equal to Null
I tried
If (a != null) Then
This expression does not work
I look at Help but can not find out
Could you please help
Thanks S.Hoa
Thank you
I tried to use =, the compiler get the error
Operator '=' is not defined for types 'System.Object' and 'System.DBNull' .
Use 'Is' operator to compare two reference types.
Therefore, I have to change to "Is"
I use VB.Net 2001
Regards
S.Hoa
"Gerald Hernandez" <Cablewizard@sp *********@Yahoo .com> wrote in message
news:eP******** ******@TK2MSFTN GP10.phx.gbl... you got it, mostly. i'm not certain if the IS keyword will give you the proper results or not. this is not a value comparison, but an Object Reference comparison. it would be safer to use: If Not (a = DBNull.Value) Then
or use the alternate test using If Not IsDBNull(a) Then
Gerald
"HS1" <so*@slingshot. co.nz> wrote in message news:1098141920 .570486@ftpsrv1 ... Thank you a is a value of a field in a table of a database. I have to check it is null or not I have a solution
If Not (a is DBNull.Value) Then
"Gerald Hernandez" <Cablewizard@sp *********@Yahoo .com> wrote in message news:OI******** ******@TK2MSFTN GP09.phx.gbl... What sort of "Null" are you looking for? Database Null? Object is Nothing? a <> 0&?
"HS1" <so*@slingshot. co.nz> wrote in message news:1098135675 .785296@ftpsrv1 ... > Hello > > Could you please help for a simple boolean expression > > If a is not equal to Null > > I tried > > If (a != null) Then > > This expression does not work > > I look at Help but can not find out > > Could you please help > > Thanks > S.Hoa > >
What object type is "a"?
You say a database field, but which object.
Is there an a.value property?
I'm still concerned about using IS here.
Take for example that A is a particular object, and System.DBNull is another
object.
The IS operator is more appropriate to determine if "A" is the same object
as DBNull, not the same value.
Gerald
"HS1" <so*@slingshot. co.nz> wrote in message
news:1098147081 .668852@ftpsrv1 ... Thank you
I tried to use =, the compiler get the error
Operator '=' is not defined for types 'System.Object' and 'System.DBNull' . Use 'Is' operator to compare two reference types. Therefore, I have to change to "Is" I use VB.Net 2001
Regards S.Hoa "Gerald Hernandez" <Cablewizard@sp *********@Yahoo .com> wrote in message news:eP******** ******@TK2MSFTN GP10.phx.gbl... you got it, mostly. i'm not certain if the IS keyword will give you the proper results or
not. this is not a value comparison, but an Object Reference comparison. it would be safer to use: If Not (a = DBNull.Value) Then
or use the alternate test using If Not IsDBNull(a) Then
Gerald
"HS1" <so*@slingshot. co.nz> wrote in message news:1098141920 .570486@ftpsrv1 ... Thank you a is a value of a field in a table of a database. I have to check it
is null or not I have a solution
If Not (a is DBNull.Value) Then
"Gerald Hernandez" <Cablewizard@sp *********@Yahoo .com> wrote in
message news:OI******** ******@TK2MSFTN GP09.phx.gbl... > What sort of "Null" are you looking for? > Database Null? > Object is Nothing? > a <> 0&? > > "HS1" <so*@slingshot. co.nz> wrote in message > news:1098135675 .785296@ftpsrv1 ... > > Hello > > > > Could you please help for a simple boolean expression > > > > If a is not equal to Null > > > > I tried > > > > If (a != null) Then > > > > This expression does not work > > > > I look at Help but can not find out > > > > Could you please help > > > > Thanks > > S.Hoa > > > > > >
Here is my code
If (DataGrid1.Item (DataGrid1.Curr entCell.RowNumb er, 5) Is DBNull.Value) Then
In this code, dataGrid1 presents data for a table. I check the value
(textual type) of current row at column 5 to see that it is Null or not.
"Gerald Hernandez" <Cablewizard@sp *********@Yahoo .com> wrote in message
news:u2******** ******@tk2msftn gp13.phx.gbl... What object type is "a"? You say a database field, but which object. Is there an a.value property?
I'm still concerned about using IS here. Take for example that A is a particular object, and System.DBNull is
another object. The IS operator is more appropriate to determine if "A" is the same object as DBNull, not the same value.
Gerald
"HS1" <so*@slingshot. co.nz> wrote in message news:1098147081 .668852@ftpsrv1 ... Thank you
I tried to use =, the compiler get the error
Operator '=' is not defined for types 'System.Object' and
'System.DBNull' . Use 'Is' operator to compare two reference types. Therefore, I have to change to "Is" I use VB.Net 2001
Regards S.Hoa "Gerald Hernandez" <Cablewizard@sp *********@Yahoo .com> wrote in message news:eP******** ******@TK2MSFTN GP10.phx.gbl... you got it, mostly. i'm not certain if the IS keyword will give you the proper results or not. this is not a value comparison, but an Object Reference comparison. it would be safer to use: If Not (a = DBNull.Value) Then
or use the alternate test using If Not IsDBNull(a) Then
Gerald
"HS1" <so*@slingshot. co.nz> wrote in message news:1098141920 .570486@ftpsrv1 ... > Thank you > a is a value of a field in a table of a database. I have to check it is null > or not > I have a solution > > If Not (a is DBNull.Value) Then > > "Gerald Hernandez" <Cablewizard@sp *********@Yahoo .com> wrote in message > news:OI******** ******@TK2MSFTN GP09.phx.gbl... > > What sort of "Null" are you looking for? > > Database Null? > > Object is Nothing? > > a <> 0&? > > > > "HS1" <so*@slingshot. co.nz> wrote in message > > news:1098135675 .785296@ftpsrv1 ... > > > Hello > > > > > > Could you please help for a simple boolean expression > > > > > > If a is not equal to Null > > > > > > I tried > > > > > > If (a != null) Then > > > > > > This expression does not work > > > > > > I look at Help but can not find out > > > > > > Could you please help > > > > > > Thanks > > > S.Hoa > > > > > > > > > > > >
Ah, I see. Well, if it were me, I would explicitly cast the underlying value
to its appropriate sqltype then check for null. However, I do not know what
kind of underlying data you are dealing with.
You could take the shortcut and use the Convert.IsDBNul l which will handle
an expression.
Like so:
If Convert.IsDBNul l(DataGrid1.Ite m(DataGrid1.Cur rentCell.RowNum ber, 5)) Then
It is possible that the way you are doing it will work fine. But it just
seems dangerous to me.
Gerald
"HS1" <so*@slingshot. co.nz> wrote in message
news:1098163724 .554694@ftpsrv1 ... Here is my code
If (DataGrid1.Item (DataGrid1.Curr entCell.RowNumb er, 5) Is DBNull.Value)
Then In this code, dataGrid1 presents data for a table. I check the value (textual type) of current row at column 5 to see that it is Null or not.
"Gerald Hernandez" <Cablewizard@sp *********@Yahoo .com> wrote in message news:u2******** ******@tk2msftn gp13.phx.gbl... What object type is "a"? You say a database field, but which object. Is there an a.value property?
I'm still concerned about using IS here. Take for example that A is a particular object, and System.DBNull is another object. The IS operator is more appropriate to determine if "A" is the same
object as DBNull, not the same value.
Gerald
"HS1" <so*@slingshot. co.nz> wrote in message news:1098147081 .668852@ftpsrv1 ... Thank you
I tried to use =, the compiler get the error
Operator '=' is not defined for types 'System.Object' and 'System.DBNull' . Use 'Is' operator to compare two reference types. Therefore, I have to change to "Is" I use VB.Net 2001
Regards S.Hoa "Gerald Hernandez" <Cablewizard@sp *********@Yahoo .com> wrote in
message news:eP******** ******@TK2MSFTN GP10.phx.gbl... > you got it, mostly. > i'm not certain if the IS keyword will give you the proper results
or not. > this is not a value comparison, but an Object Reference comparison. > it would be safer to use: > If Not (a = DBNull.Value) Then > > or use the alternate test using > If Not IsDBNull(a) Then > > Gerald > > "HS1" <so*@slingshot. co.nz> wrote in message > news:1098141920 .570486@ftpsrv1 ... > > Thank you > > a is a value of a field in a table of a database. I have to check
it is > null > > or not > > I have a solution > > > > If Not (a is DBNull.Value) Then > > > > "Gerald Hernandez" <Cablewizard@sp *********@Yahoo .com> wrote in message > > news:OI******** ******@TK2MSFTN GP09.phx.gbl... > > > What sort of "Null" are you looking for? > > > Database Null? > > > Object is Nothing? > > > a <> 0&? > > > > > > "HS1" <so*@slingshot. co.nz> wrote in message > > > news:1098135675 .785296@ftpsrv1 ... > > > > Hello > > > > > > > > Could you please help for a simple boolean expression > > > > > > > > If a is not equal to Null > > > > > > > > I tried > > > > > > > > If (a != null) Then > > > > > > > > This expression does not work > > > > > > > > I look at Help but can not find out > > > > > > > > Could you please help > > > > > > > > Thanks > > > > S.Hoa > > > > > > > > > > > > > > > > > > > >
Thank you
"Gerald Hernandez" <Cablewizard@sp *********@Yahoo .com> wrote in message
news:eD******** ******@TK2MSFTN GP14.phx.gbl... Ah, I see. Well, if it were me, I would explicitly cast the underlying
value to its appropriate sqltype then check for null. However, I do not know
what kind of underlying data you are dealing with. You could take the shortcut and use the Convert.IsDBNul l which will handle an expression. Like so:
If Convert.IsDBNul l(DataGrid1.Ite m(DataGrid1.Cur rentCell.RowNum ber, 5))
Then It is possible that the way you are doing it will work fine. But it just seems dangerous to me.
Gerald
"HS1" <so*@slingshot. co.nz> wrote in message news:1098163724 .554694@ftpsrv1 ... Here is my code
If (DataGrid1.Item (DataGrid1.Curr entCell.RowNumb er, 5) Is DBNull.Value) Then In this code, dataGrid1 presents data for a table. I check the value (textual type) of current row at column 5 to see that it is Null or not.
"Gerald Hernandez" <Cablewizard@sp *********@Yahoo .com> wrote in message news:u2******** ******@tk2msftn gp13.phx.gbl... What object type is "a"? You say a database field, but which object. Is there an a.value property?
I'm still concerned about using IS here. Take for example that A is a particular object, and System.DBNull is another object. The IS operator is more appropriate to determine if "A" is the same object as DBNull, not the same value.
Gerald
"HS1" <so*@slingshot. co.nz> wrote in message news:1098147081 .668852@ftpsrv1 ... > Thank you > > I tried to use =, the compiler get the error > > Operator '=' is not defined for types 'System.Object' and 'System.DBNull' . > Use 'Is' operator to compare two reference types. > Therefore, I have to change to "Is" > I use VB.Net 2001 > > Regards > S.Hoa > "Gerald Hernandez" <Cablewizard@sp *********@Yahoo .com> wrote in message > news:eP******** ******@TK2MSFTN GP10.phx.gbl... > > you got it, mostly. > > i'm not certain if the IS keyword will give you the proper results or not. > > this is not a value comparison, but an Object Reference
comparison. > > it would be safer to use: > > If Not (a = DBNull.Value) Then > > > > or use the alternate test using > > If Not IsDBNull(a) Then > > > > Gerald > > > > "HS1" <so*@slingshot. co.nz> wrote in message > > news:1098141920 .570486@ftpsrv1 ... > > > Thank you > > > a is a value of a field in a table of a database. I have to
check it is > > null > > > or not > > > I have a solution > > > > > > If Not (a is DBNull.Value) Then > > > > > > "Gerald Hernandez" <Cablewizard@sp *********@Yahoo .com> wrote in message > > > news:OI******** ******@TK2MSFTN GP09.phx.gbl... > > > > What sort of "Null" are you looking for? > > > > Database Null? > > > > Object is Nothing? > > > > a <> 0&? > > > > > > > > "HS1" <so*@slingshot. co.nz> wrote in message > > > > news:1098135675 .785296@ftpsrv1 ... > > > > > Hello > > > > > > > > > > Could you please help for a simple boolean expression > > > > > > > > > > If a is not equal to Null > > > > > > > > > > I tried > > > > > > > > > > If (a != null) Then > > > > > > > > > > This expression does not work > > > > > > > > > > I look at Help but can not find out > > > > > > > > > > Could you please help > > > > > > > > > > Thanks > > > > > S.Hoa > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: greg |
last post by:
Discussion is invited on the following proto-PEP.
-------------------------------------------------------------
PEP ??? - Overloadable Boolean Operators
========================================
SUMMARY
This PEP proposes an extension to permit objects to define their own
|
by: Max Speransky |
last post by:
Hello
My task is to validate expression and get value of it in boolean variable.
I try to do following:
CREATE OR REPLACE FUNCTION get_value(integer) RETURNS boolean AS'
DECLARE
Ret boolean;
Op TEXT = ''='';
BEGIN
|
by: Coco |
last post by:
Hi!
Does c# has any class method that will be able to evaluate
a given string e.g ((True && False) || (True && True)) and
return the result in boolean for this case is true
Thanks!
|
by: Wit Baas |
last post by:
Hi all
I need do the following based on Boolean Algebra
ex 1. (M271/M272/M651)+(450/965)/M642/M646
All possible result
M271 + 450
M271 + 965
M272 + 450
M272 + 965
|
by: Daron |
last post by:
In my SQL I have a column that returns a boolean value (-1 or 0), no
problem.
I need to be able to only see the records that return a 0 (False). I
can sort and bring these to the top.
When I attempt to create a criteria on the QBE or filter (right click
menu), I am confronted with a ""This expression is typed incorrectly,
or is too complex to be evaluated"" error.
| |
by: Shawnk |
last post by:
I would like to perform various boolean operations on bitmapped
(FlagsAttribute)
enum types for a state machine design as in;
-------------------
enum portState {
Unknown,
Open,
|
by: rguarnieri |
last post by:
Hi!
I'm trying to create a query with a boolean expression like this:
select (4 and 1) as Value from Table1
this query return always -1, but when I make the same calculation in
visual basic, the value returned is 0.
Can anyone tell me why the expression (4 and 1) return different value
|
by: KimmoA |
last post by:
First of all: I love C and think that it's beautiful. However, there is
at least one MAJOR flaw: the lack of a boolean type.
OK. Some of you might refer to C99 and its _Bool (what's up with the
uppercase 'B' anyway?) and the header you can include (apparently) to
get a real "bool". This isn't my point, however -- it should have been
there from the beginning.
char is a small int. We all know that. However, "char some_bool = 0;"
simply...
|
by: Greg Corradini |
last post by:
Hello all,
I'm having trouble understanding why the following code evaluates as it
does:
True
-1
In the 2.4 Python Reference Manual, I get the following explanation for the
'and' operator in 5.10 Boolean operations:
" The expression x and y first evaluates x; if x is false, its value is
|
by: sunil |
last post by:
Hello,
I have a boolean expression thats specified in pre/in/post fix
notations, lets assume infix for the sake of this argument. The
expression can be in any of the following forms:
Form A:
-------------
(As1&&/||Bs1&&/||Cs1 )|| (As2&&/||Bs2&&/||Cs2)||....(Asn&&/||Bsn&&/||
Csn) with following rules:
-Inner ANDs/ORs are optional but if they are specified in one nesting
they must be specified in all nestings with same connector type...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |