Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: DbNull, novice user question


Message #1 by "Silas Wild" <SILAS@d...> on Tue, 04 Mar 2003 07:58:28 -0800
I'm using a data reader to fill some labels in a web form from a
MSAccess97 database.  When a row has a cell with missing information,
the form fails to render with a "cast from type DbNull to type string is
not valid" error.  My erroneous code goes something like this:
labelname.text=dtreader("columnname")
Help?

Message #2 by "Silas Wild" <SILAS@d...> on Tue, 04 Mar 2003 08:31:02 -0800
google had the answer, just had to ask the proper question.
Thanks.

>>> SILAS@d... 03/04/03 07:58AM >>>
I'm using a data reader to fill some labels in a web form from a
MSAccess97 database.  When a row has a cell with missing information,
the form fails to render with a "cast from type DbNull to type string is
not valid" error.  My erroneous code goes something like this:
labelname.text=dtreader("columnname")
Help?



Message #3 by <stavros@r...> on Tue, 4 Mar 2003 13:44:13 -0500
And what did google say?

> 
> From: "Silas Wild" <SILAS@d...>
> Date: 2003/03/04 Tue AM 11:31:02 EST
> To: "ASP.NET" <aspx@p...>
> Subject: [aspx] Re: DbNull, novice user question
> 
> google had the answer, just had to ask the proper question.
> Thanks.
> 
> >>> SILAS@d... 03/04/03 07:58AM >>>
> I'm using a data reader to fill some labels in a web form from a
> MSAccess97 database.  When a row has a cell with missing information,
> the form fails to render with a "cast from type DbNull to type string is
> not valid" error.  My erroneous code goes something like this:
> labelname.text=dtreader("columnname")
> Help?
> 
> 
> 
> 
> 

1

Message #4 by "Silas Wild" <SILAS@d...> on Tue, 04 Mar 2003 11:46:08 -0800
Google sent me to the 247 .net site which said,
using vb.net, where n=column number in the table (first column is 0,
etc.), add the condition:

If not (dtreader.IsDbNull(n)) Then
  labelname.text=dtreader("columnname")
End If
>>> stavros@r... 03/04/03 10:44AM >>>
And what did google say?

> 
> From: "Silas Wild" <SILAS@d...>
> Date: 2003/03/04 Tue AM 11:31:02 EST
> To: "ASP.NET" <aspx@p...>
> Subject: [aspx] Re: DbNull, novice user question
> 
> google had the answer, just had to ask the proper question.
> Thanks.
> 
> >>> SILAS@d... 03/04/03 07:58AM >>>
> I'm using a data reader to fill some labels in a web form from a
> MSAccess97 database.  When a row has a cell with missing information,
> the form fails to render with a "cast from type DbNull to type string
is
> not valid" error.  My erroneous code goes something like this:
> labelname.text=dtreader("columnname")
> Help?
> 
> 
> 
> 
> 

1




  Return to Index