473,666 Members | 2,612 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1991
Jos
"Randy Rubin" <ra***@imarubin .com> wrote in message
news:%2******** ********@TK2MSF TNGP11.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******** *******@tk2msft ngp13.phx.gbl.. .
"Randy Rubin" <ra***@imarubin .com> wrote in message
news:%2******** ********@TK2MSF TNGP11.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.InvalidO perationExcepti on: 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******** ********@TK2MSF TNGP11.phx.gbl. ..
any problems with

IsDBNull ( value )

?

"Jos" <jo************ ***@fastmail.fm > wrote in message
news:%2******** *******@tk2msft ngp13.phx.gbl.. .
"Randy Rubin" <ra***@imarubin .com> wrote in message
news:%2******** ********@TK2MSF TNGP11.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.InvalidO perationExcepti on: 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******** ********@TK2MSF TNGP11.phx.gbl. ..
any problems with

IsDBNull ( value )

?

"Jos" <jo************ ***@fastmail.fm > wrote in message
news:%2******** *******@tk2msft ngp13.phx.gbl.. .
"Randy Rubin" <ra***@imarubin .com> wrote in message
news:%2******** ********@TK2MSF TNGP11.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*********@di scussions.micro soft.com> wrote in message
news:42******** *************** ***********@mic rosoft.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.InvalidO perationExcepti on: 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******** ********@TK2MSF TNGP11.phx.gbl. ..
any problems with

IsDBNull ( value )

?

"Jos" <jo************ ***@fastmail.fm > wrote in message
news:%2******** *******@tk2msft ngp13.phx.gbl.. .
> "Randy Rubin" <ra***@imarubin .com> wrote in message
> news:%2******** ********@TK2MSF TNGP11.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.GetOrdi nal(fieldName))

Mark Whitton

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

--Randy

"Reza Solouki" <Re*********@di scussions.micro soft.com> wrote in message
news:42******** *************** ***********@mic rosoft.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.InvalidO perationExcepti on: 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******** ********@TK2MSF TNGP11.phx.gbl. ..
> any problems with
>
> IsDBNull ( value )
>
> ?
>
>
>
> "Jos" <jo************ ***@fastmail.fm > wrote in message
> news:%2******** *******@tk2msft ngp13.phx.gbl.. .
> > "Randy Rubin" <ra***@imarubin .com> wrote in message
> > news:%2******** ********@TK2MSF TNGP11.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
12200
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 byte what is returned from a field in a database? Josh
6
35348
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 db records are date type with null permissible. How should i handle the insertion of a null date record into the array? I just cant leave it empty right? K
26
45408
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.) How can I achieve this? I suppose I would get the most-hated "table/view is changing, trigger/function may not see it" error if I tried to write a trigger that checks the uniqueness of non-null values upon insert/update.
12
1788
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 the following properties. TestID int QuestionID int AnswerID int So, this is a simple example, but I want to be able to know if AnswerID is
10
52619
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 string or NULL. Becaus i have a if statement: if .... cursor.execute(".................insert NULL ..............") if ....
7
40026
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 constructor. Those fields are modified during various methods in the class. One method updates the database with the values of the class fields. I have everything working fine for string fields but am running into problems with integers and null values.
17
4520
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 selected into 2 different SP variables and compared for equal. They are both NULL, but do not compare as equal. When the Not NULL columns (SALARY) are compared, they do compare as equal.
3
12284
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 (0) length string, an empty Field, or no value at all - so exactly what is Null? The purpose of this Topic is hopefully to explain what a Null Value is, discuss some peculiarities about Nulls, show how we can detect them, and finally, how to convert...
4
5596
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 null) exists in database table and return 0 if exists or else -1 using stored procedure? Please help. USE GO IF EXISTS (SELECT name FROM sys.databases WHERE name = 'ExampleDatabase')
2
14650
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 can I pass null value as parameter to the database stored procedure programattically using C#? Although I can check for empty column (the following code passes string.Empty as parameter but how to pass null value?), I cannot check for null value...
0
8454
marktang
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...
0
8883
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, 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...
0
8645
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7389
agi2029
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...
1
6203
isladogs
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...
0
4200
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...
1
2776
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2013
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1778
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.