Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Null Values From Database

Reply
Thread Tools

Null Values From Database

 
 
Randy Rubin
Guest
Posts: n/a
 
      08-03-2004
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





 
Reply With Quote
 
 
 
 
Jos
Guest
Posts: n/a
 
      08-03-2004
"Randy Rubin" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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


 
Reply With Quote
 
 
 
 
Randy Rubin
Guest
Posts: n/a
 
      08-03-2004
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." <(E-Mail Removed)> wrote in message
news:%23$(E-Mail Removed)...
> any problems with
>
> IsDBNull ( value )
>
> ?
>
>
>
> "Jos" <(E-Mail Removed)> wrote in message
> news:%236h$(E-Mail Removed)...
> > "Randy Rubin" <(E-Mail Removed)> wrote in message
> > news:%(E-Mail Removed)...
> > > 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
> >
> >

>
>



 
Reply With Quote
 
=?Utf-8?B?UmV6YSBTb2xvdWtp?=
Guest
Posts: n/a
 
      08-03-2004
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." <(E-Mail Removed)> wrote in message
> news:%23$(E-Mail Removed)...
> > any problems with
> >
> > IsDBNull ( value )
> >
> > ?
> >
> >
> >
> > "Jos" <(E-Mail Removed)> wrote in message
> > news:%236h$(E-Mail Removed)...
> > > "Randy Rubin" <(E-Mail Removed)> wrote in message
> > > news:%(E-Mail Removed)...
> > > > 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
> > >
> > >

> >
> >

>
>
>

 
Reply With Quote
 
z. f.
Guest
Posts: n/a
 
      08-03-2004
any problems with

IsDBNull ( value )

?



"Jos" <(E-Mail Removed)> wrote in message
news:%236h$(E-Mail Removed)...
> "Randy Rubin" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > 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
>
>



 
Reply With Quote
 
Randy Rubin
Guest
Posts: n/a
 
      08-04-2004
Can someone post a code example that will check to see is the row or field
is null?

--Randy

"Reza Solouki" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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." <(E-Mail Removed)> wrote in message
> > news:%23$(E-Mail Removed)...
> > > any problems with
> > >
> > > IsDBNull ( value )
> > >
> > > ?
> > >
> > >
> > >
> > > "Jos" <(E-Mail Removed)> wrote in message
> > > news:%236h$(E-Mail Removed)...
> > > > "Randy Rubin" <(E-Mail Removed)> wrote in message
> > > > news:%(E-Mail Removed)...
> > > > > 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
> > > >
> > > >
> > >
> > >

> >
> >
> >



 
Reply With Quote
 
Mark Whitton
Guest
Posts: n/a
 
      08-04-2004
This example is when using a data reader and checks if a field is null

reader.IsDBNull(reader.GetOrdinal(fieldName))

Mark Whitton

"Randy Rubin" <(E-Mail Removed)> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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." <(E-Mail Removed)> wrote in message
> > > news:%23$(E-Mail Removed)...
> > > > any problems with
> > > >
> > > > IsDBNull ( value )
> > > >
> > > > ?
> > > >
> > > >
> > > >
> > > > "Jos" <(E-Mail Removed)> wrote in message
> > > > news:%236h$(E-Mail Removed)...
> > > > > "Randy Rubin" <(E-Mail Removed)> wrote in message
> > > > > news:%(E-Mail Removed)...
> > > > > > 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
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> > >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Database Database Database scott93727@gmail.com Computer Information 0 09-27-2012 02:43 AM
DataBase DataBase DataBase DataBase scott93727@gmail.com Computer Information 0 09-26-2012 09:40 AM
"stringObj == null" vs "stringObj.equals(null)", for null check?? qazmlp1209@rediffmail.com Java 5 03-29-2006 10:37 PM
FAQ Reformating the Dates in ASP.NET / MSSQL Database that has some <NULL> values Rookie Card ASP .Net 1 08-05-2005 10:31 AM
checking the null values in the database column............ Jimmy Crider ASP .Net 3 02-18-2004 01:51 PM



Advertisments