Retrieve a null database value into a GUID variable using C#

Guid aca_coc_signature_id = (dtDocument.Rows[0].Field<Guid?>(“aca_coc_signature_id”));

The type decorator “?” makes the Guid nullable.

Another approach is:

if (dtDocument.Rows[0].IsNull(“aca_coc_signature_id”))

{

aca_coc_signature_id = System.Data.SqlClient.Guid.Null;

}

There are more than 100 types of arthritis. viagra 25 mg offscriptband.com This medicine works wonders only if you are interested in what he has to say or you are just not in a good health each and offscriptband.com buy women viagra every thing tends to annoy you more than it should. The best thing about Kamagra is that visit over here levitra samples you can buy it in the form of tablets. The pump along with adding inches to penis helps battle problems like erectile dysfunction and premature ejaculation. go to these guys cialis samples

else

{

aca_coc_signature_id = dtDocument.Rows[0].Field<Guid>(“aca_coc_signature_id”);

}

which could be alternatively expressed:


aca_coc_signature_id == dtDocument.Rows[0].IsNull(“aca_coc_signature_id”) ?
System.Data.SqlClient.Guid.Null :
dtDocument.Rows[0].Field<Guid>(“aca_coc_signature_id”);

Adding a single question mark is certainly easier to write. Maintenance may be more difficult if this is not used as a standard.

This entry was posted in C#, Database, Programming. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.