Forum Post: RE: Uniqueidentifier is null

  • Thread starter Thread starter Avadhoot Kulkarni
  • Start date Start date
Status
Not open for further replies.
A

Avadhoot Kulkarni

Guest
Hi, As per the ADO.NET standard, The reader.getGuid() will throw the "InvalidCastException" if the value is null or DBNull. msdn.microsoft.com/.../system.data.sqlclient.sqldatareader.getguid(v=vs.110).aspx You can use reader.IsDBNull(0) to chek if the value is null and if not; then you can use the Specific type Accessor methods of DataReader class. If you do not wish to use the IsDBNull() API; then you can replace the GetGuid() to GetValue() call; this returns the value (including null); Hope this helps you resolve your error.

Continue reading...
 
Status
Not open for further replies.
Back
Top