By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,721 Members | 1,324 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,721 IT Pros & Developers. It's quick & easy.

error when dataset returns a null value.

P: n/a
hi,

I got an error when the dataset returns a null value.
eg.
string a;
a = (string)ds.Tables[0].Rows[0][2];

How do I handle this error ? Thanks.

regards,
andrew

Mar 28 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Check out the 'as' keyword.

e.g.

a = ds.Tables[0].Rows[0][2] as string;

Andrew
"Andrew" <An****@discussions.microsoft.com> wrote in message
news:7A**********************************@microsof t.com...
hi,

I got an error when the dataset returns a null value.
eg.
string a;
a = (string)ds.Tables[0].Rows[0][2];

How do I handle this error ? Thanks.

regards,
andrew

Mar 28 '06 #2

P: n/a
it works thanks

"J055" wrote:
Check out the 'as' keyword.

e.g.

a = ds.Tables[0].Rows[0][2] as string;

Andrew
"Andrew" <An****@discussions.microsoft.com> wrote in message
news:7A**********************************@microsof t.com...
hi,

I got an error when the dataset returns a null value.
eg.
string a;
a = (string)ds.Tables[0].Rows[0][2];

How do I handle this error ? Thanks.

regards,
andrew


Mar 28 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.