473,395 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Null Values From Database

How do I handle Testing for null values in a database? Here is a Line of
Code:

If Not jNull("JNum") Is DBNull Then

And this is the Error:

BC30684: 'DBNull' is a type and cannot be used as an expression.

Thanks

Randy

Nov 18 '05 #1
6 1976
Jos
"Randy Rubin" <ra***@imarubin.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
How do I handle Testing for null values in a database? Here is a Line of
Code:

If Not jNull("JNum") Is DBNull Then

And this is the Error:

BC30684: 'DBNull' is a type and cannot be used as an expression.


If ( TypeOf jNull("JNum") Is DBNull ) Then

Jos
Nov 18 '05 #2
any problems with

IsDBNull ( value )

?

"Jos" <jo***************@fastmail.fm> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
"Randy Rubin" <ra***@imarubin.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
How do I handle Testing for null values in a database? Here is a Line of Code:

If Not jNull("JNum") Is DBNull Then

And this is the Error:

BC30684: 'DBNull' is a type and cannot be used as an expression.


If ( TypeOf jNull("JNum") Is DBNull ) Then

Jos

Nov 18 '05 #3
This:

If Not IsDBNull(jNull("JNum")) Then
Seemed to work, But now I am getting:

System.InvalidOperationException: Invalid attempt to read when no data is
present

I'm assuming this is because the value is Null... Anymore Ideas?
"z. f." <zi**@info-scopeREMSPAM.co.il> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
any problems with

IsDBNull ( value )

?

"Jos" <jo***************@fastmail.fm> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
"Randy Rubin" <ra***@imarubin.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
How do I handle Testing for null values in a database? Here is a Line of Code:

If Not jNull("JNum") Is DBNull Then

And this is the Error:

BC30684: 'DBNull' is a type and cannot be used as an expression.


If ( TypeOf jNull("JNum") Is DBNull ) Then

Jos


Nov 18 '05 #4
Just to give you a little bad news, none of these would work if your type of data is datetime - I am still looking for a solution for this!

"Randy Rubin" wrote:
This:

If Not IsDBNull(jNull("JNum")) Then
Seemed to work, But now I am getting:

System.InvalidOperationException: Invalid attempt to read when no data is
present

I'm assuming this is because the value is Null... Anymore Ideas?
"z. f." <zi**@info-scopeREMSPAM.co.il> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
any problems with

IsDBNull ( value )

?

"Jos" <jo***************@fastmail.fm> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
"Randy Rubin" <ra***@imarubin.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
> How do I handle Testing for null values in a database? Here is a Line

of
> Code:
>
> If Not jNull("JNum") Is DBNull Then
>
> And this is the Error:
>
> BC30684: 'DBNull' is a type and cannot be used as an expression.

If ( TypeOf jNull("JNum") Is DBNull ) Then

Jos



Nov 18 '05 #5
Can someone post a code example that will check to see is the row or field
is null?

--Randy

"Reza Solouki" <Re*********@discussions.microsoft.com> wrote in message
news:42**********************************@microsof t.com...
Just to give you a little bad news, none of these would work if your type of data is datetime - I am still looking for a solution for this!
"Randy Rubin" wrote:
This:

If Not IsDBNull(jNull("JNum")) Then
Seemed to work, But now I am getting:

System.InvalidOperationException: Invalid attempt to read when no data is present

I'm assuming this is because the value is Null... Anymore Ideas?
"z. f." <zi**@info-scopeREMSPAM.co.il> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
any problems with

IsDBNull ( value )

?

"Jos" <jo***************@fastmail.fm> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
> "Randy Rubin" <ra***@imarubin.com> wrote in message
> news:%2****************@TK2MSFTNGP11.phx.gbl...
> > How do I handle Testing for null values in a database? Here is a Line of
> > Code:
> >
> > If Not jNull("JNum") Is DBNull Then
> >
> > And this is the Error:
> >
> > BC30684: 'DBNull' is a type and cannot be used as an expression.
>
> If ( TypeOf jNull("JNum") Is DBNull ) Then
>
> Jos
>
>


Nov 18 '05 #6
This example is when using a data reader and checks if a field is null

reader.IsDBNull(reader.GetOrdinal(fieldName))

Mark Whitton

"Randy Rubin" <ra***@imarubin.com> wrote in message
news:mR4Qc.1765$aR2.346@okepread04...
Can someone post a code example that will check to see is the row or field
is null?

--Randy

"Reza Solouki" <Re*********@discussions.microsoft.com> wrote in message
news:42**********************************@microsof t.com...
Just to give you a little bad news, none of these would work if your type
of data is datetime - I am still looking for a solution for this!

"Randy Rubin" wrote:
This:

If Not IsDBNull(jNull("JNum")) Then
Seemed to work, But now I am getting:

System.InvalidOperationException: Invalid attempt to read when no data
is present

I'm assuming this is because the value is Null... Anymore Ideas?
"z. f." <zi**@info-scopeREMSPAM.co.il> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
> any problems with
>
> IsDBNull ( value )
>
> ?
>
>
>
> "Jos" <jo***************@fastmail.fm> wrote in message
> news:%2***************@tk2msftngp13.phx.gbl...
> > "Randy Rubin" <ra***@imarubin.com> wrote in message
> > news:%2****************@TK2MSFTNGP11.phx.gbl...
> > > How do I handle Testing for null values in a database? Here is
a Line > of
> > > Code:
> > >
> > > If Not jNull("JNum") Is DBNull Then
> > >
> > > And this is the Error:
> > >
> > > BC30684: 'DBNull' is a type and cannot be used as an expression.
> >
> > If ( TypeOf jNull("JNum") Is DBNull ) Then
> >
> > Jos
> >
> >
>
>


Nov 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Joshua Ruppert | last post by:
A section of the documentation for the isSet() function states: Also note that a NULL byte ("\0") is not equivalent to the PHP NULL constant. Where would you encounter a NULL byte? Is a null...
6
by: Kris M | last post by:
How do i handle a null value for a date variable type. I am retrieving date data from an access database and storing the records in an array for processing. The array field has a date type and the...
26
by: Agoston Bejo | last post by:
I want to enforce such a constraint on a column that would ensure that the values be all unique, but this wouldn't apply to NULL values. (I.e. there may be more than one NULL value in the column.)...
12
by: D Witherspoon | last post by:
What is the accepted method of creating a data class or business rules object class with properties that will allow the returning of null values? For example... I have a class named CResults with...
10
by: Python_it | last post by:
Python 2.4 MySQL-python.exe-1.2.0.win32-py2.4.zip How can I insert a NULL value in a table (MySQL-database). I can't set a var to NULL? Or is there a other possibility? My var must be variable...
7
by: Dan | last post by:
I'm fairly new to C# and I am having some problems understanding int variables and null values. I have created a class that populates the values of it's fields from a DataReader in it's...
17
by: Mark A | last post by:
DB2 8.2 for Linux, FP 10 (also performs the same on DB2 8.2 for Windoes, FP 11). Using the SAMPLE database, tables EMP and EMLOYEE. In the followng stored procedure, 2 NULL columns (COMM) are...
3
ADezii
by: ADezii | last post by:
Null as it relates to database development is one of life's little mysteries and a topic of total confusion for novices who venture out into the database world. A Null Value is not zero (0), a zero...
4
by: qwedster | last post by:
Howdy folks! I am using stored procedure to see if a value exists in database table and return 0 if exists or else -1, in the following SQL queries. However how to check if a value (that is...
2
by: qwedster | last post by:
Folk! How to programattically check if null value exists in database table (using stored procedure)? I know it's possble in the Query Analyzer (see last SQL query batch statements)? But how...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.