error when dataset returns a null value.

G

Guest

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
 
G

Guest

it works thanks

J055 said:
Check out the 'as' keyword.

e.g.

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

Andrew


Andrew said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top