Dan Flood
asked on
VB2005 Database Null Exceptions
Hi - my program is crashing when it reaches this code:
If IsNothing(Formula.Comments ) Then
txtOut.Text += "There are no formula specific notes."
Else
txtOut.Text += Formula.Comments
End If
Formula.Comments is a field in an Access Database and the IsNothing line is where it dies. It crashes to (myform).designer,vb at line:
Throw New System.Data.StrongTypingEx ception("T he value for column 'Comments' in table 'tblFormulas' is DBNull.", e)
StrongTypingException was unhandled.
I thought the IsNothing function prevented this error? I want to test for a null and do something about it - not crash :)
thanks
If IsNothing(Formula.Comments
txtOut.Text += "There are no formula specific notes."
Else
txtOut.Text += Formula.Comments
End If
Formula.Comments is a field in an Access Database and the IsNothing line is where it dies. It crashes to (myform).designer,vb at line:
Throw New System.Data.StrongTypingEx
StrongTypingException was unhandled.
I thought the IsNothing function prevented this error? I want to test for a null and do something about it - not crash :)
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
hongjun: Thanks but unfortunately that didn't work
TheLearnedOne: I think this is the right answer - but I cannot figure out where to put: <xs:element name="Region" codegen:nullValue="-1" type="xs:string" minOccurs="0" /> I have no element named "region" in my dataset??
TheLearnedOne: I think this is the right answer - but I cannot figure out where to put: <xs:element name="Region" codegen:nullValue="-1" type="xs:string" minOccurs="0" /> I have no element named "region" in my dataset??
The Northwind database Customers table has the Region column. You need to find the column name that you are having problems with.
Bob
Bob
ASKER
Oh nevermind I see - thank you very much!
If Formula.Comments.Equals(Sy