Checking if a record in datareader is NULL

Posted by user279521 on Stack Overflow See other posts from Stack Overflow or by user279521
Published on 2010-03-22T14:47:06Z Indexed on 2010/03/22 14:51 UTC
Read the original article Hit count: 235

Filed under:
|

I have browsed thru other postings on S/O, but I can't find a solution that works for me.

I have a datareader that might return a null value, and if so, I want to value to equal blank

txtMiddleName.Text = rdrGetUserInfo.GetString(1) ?? "";

The string above does not work. When I walk thru the code, the code jumps to my error trapping block;

Any ideas?

© Stack Overflow or respective owner

Related posts about c#3.5

Related posts about asp.net-3.5