PC Review


Reply
Thread Tools Rate Thread

DataSets, adapters, and Db Null's

 
 
=?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?=
Guest
Posts: n/a
 
      18th Aug 2005
I have a dataset containing a table having some null column values
omsg += "<tr><td>Fax</td><td>" + .usrFax + "</td></tr>"
when i assign the value to a string i get a runtime error saying string to
dbnull caste problem.
what's the best way to handle this?
tyhnaks
kes

--
thanks (as always)
some day i''m gona pay this forum back for all the help i''m getting
kes
 
Reply With Quote
 
 
 
 
W.G. Ryan MVP
Guest
Posts: n/a
 
      18th Aug 2005
Check the value for IsDBNull and if it is, return a string empty
http://www.knowdotnet.com/articles/h...printable.html
or some other value that you want.
"WebBuilder451" <(E-Mail Removed)> wrote in message
news:E4A84CED-9844-45BB-A1C8-(E-Mail Removed)...
>I have a dataset containing a table having some null column values
> omsg += "<tr><td>Fax</td><td>" + .usrFax + "</td></tr>"
> when i assign the value to a string i get a runtime error saying string to
> dbnull caste problem.
> what's the best way to handle this?
> tyhnaks
> kes
>
> --
> thanks (as always)
> some day i''m gona pay this forum back for all the help i''m getting
> kes



 
Reply With Quote
 
=?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?=
Guest
Posts: n/a
 
      18th Aug 2005
Thanks,
That does the job. I was hoping for a way to set a default value as a part
of the dataset.table(row)column defination, but looking at it again i can see
this would have it's own issues.
thank You!
kes
--
thanks (as always)
some day i''m gona pay this forum back for all the help i''m getting
kes


"W.G. Ryan MVP" wrote:

> Check the value for IsDBNull and if it is, return a string empty
> http://www.knowdotnet.com/articles/h...printable.html
> or some other value that you want.
> "WebBuilder451" <(E-Mail Removed)> wrote in message
> news:E4A84CED-9844-45BB-A1C8-(E-Mail Removed)...
> >I have a dataset containing a table having some null column values
> > omsg += "<tr><td>Fax</td><td>" + .usrFax + "</td></tr>"
> > when i assign the value to a string i get a runtime error saying string to
> > dbnull caste problem.
> > what's the best way to handle this?
> > tyhnaks
> > kes
> >
> > --
> > thanks (as always)
> > some day i''m gona pay this forum back for all the help i''m getting
> > kes

>
>
>

 
Reply With Quote
 
W.G. Ryan MVP
Guest
Posts: n/a
 
      18th Aug 2005
You can use IsNull or whaatever equivalent the db you're using has, but that
presents a lot of potential problems b/c depending on how you do it, the
default value will be updated in the db when it should be null. On controls
like the datagrid, you can specify a NullText property that will show
instead of <Null> but I don't think that helps here.

Glad it's working for you though and if you have any other questions, let me
know.

Cheers,

Bill
"WebBuilder451" <(E-Mail Removed)> wrote in message
news:659C6636-1483-44C1-B029-(E-Mail Removed)...
> Thanks,
> That does the job. I was hoping for a way to set a default value as a part
> of the dataset.table(row)column defination, but looking at it again i can
> see
> this would have it's own issues.
> thank You!
> kes
> --
> thanks (as always)
> some day i''m gona pay this forum back for all the help i''m getting
> kes
>
>
> "W.G. Ryan MVP" wrote:
>
>> Check the value for IsDBNull and if it is, return a string empty
>> http://www.knowdotnet.com/articles/h...printable.html
>> or some other value that you want.
>> "WebBuilder451" <(E-Mail Removed)> wrote in
>> message
>> news:E4A84CED-9844-45BB-A1C8-(E-Mail Removed)...
>> >I have a dataset containing a table having some null column values
>> > omsg += "<tr><td>Fax</td><td>" + .usrFax + "</td></tr>"
>> > when i assign the value to a string i get a runtime error saying string
>> > to
>> > dbnull caste problem.
>> > what's the best way to handle this?
>> > tyhnaks
>> > kes
>> >
>> > --
>> > thanks (as always)
>> > some day i''m gona pay this forum back for all the help i''m getting
>> > kes

>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
Problem with using table adapters with datasets TheVillageCodingIdiot Microsoft Dot NET Framework 1 25th Nov 2008 04:09 PM
Is dispose necessary in this scenario with datasets and adapters? pkellnernews@comcast.net Microsoft ADO .NET 1 12th Apr 2006 09:27 AM
Transactions and Typed DataSets, Adapters (Visual Studio 2005) Mike Smith Microsoft ADO .NET 1 19th Nov 2005 03:59 AM
Data adapters, connections, and datasets Dave Cullen Microsoft VB .NET 2 23rd Aug 2005 07:44 AM
Data adapters and datasets R Microsoft VB .NET 4 5th Feb 2004 02:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:14 PM.