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

VulpesRank #55 · 29.2K reputationPosted Dec 21, 2013, 11:52 PM EST
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
Jignesh TrivediRank #16 · 50.3K reputationPosted Dec 22, 2013, 7:34 PM EST
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.
ToBe152 reputationPosted Dec 22, 2013, 10:41 PM EST