|
-
Mar 26th, 2003, 01:40 PM
#1
Thread Starter
PowerPoster
Converting datarow results from null to string?
Hello,
I have a datarow that I get back from the database. It contains varchar's, int's, datetime's, and char types. What I would like to do is convert all the string types (varchar) that are null into blank strings.
Is there an easy way to go through the items in the datarow and convert the null strings into blank strings?
I am currently doing this:
if(dr["myItem"] == null)
myLabel.Text = "";
else
myLabel.Text = dr["myItem"].toString();
It sucks having to do that for each of the strings that could be null. I have 10 items in the datarow that are allowed to be null.
I am hoping there is an easy foreach statement or something I can do.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|