Dear All,
I'm getting this error when reach this lines of my code
Conversion from type 'DBNull' to type 'String' is not valid
this is my code :
If DS.Tables(0).Rows.Count <> 0 Then
blnD = DS.Tables(0).Rows(0)("ItemExist")
FORM1_ID = DS.Tables(0).Rows(0)("FORMID")
Prev_FORM_ID = DS.Tables(0).Rows(0)("PREVFORMID") <--- in this line the debuger will stop and give me the error :(
lblDONE.Text = "Successfully Saved"
what to do ??
Loading
VulpesPosted Dec 22, 2013, 4:52 AM
Prev_FORM_ID = DS.Tables(0).Rows(0)("PREVFORMID")
to this:
If Not DS.Tables(0).Rows(0).IsNull("PREVFORMID") Then
Prev_FORM_ID = DS.Tables(0).Rows(0)("PREVFORMID")
End If
ToBePosted Dec 23, 2013, 3:41 AM
Jignesh TrivediPosted Dec 23, 2013, 12:34 AM
hi,
try...
if (! DBNull.Value.Equals(DS.Tables(0).Rows(0)("PREVFORMID")))
Prev_FORM_ID = DS.Tables(0).Rows(0)("PREVFORMID")
else
Prev_FORM_ID = String.Empty;
hope this will help you.