How to handle DBNull DataType for Ms access ??
Hi,
I have problem in using this function to check if the field is empty or null :
Let say , I have connect to a Database and set up Dataset :
Dim Ds as dataset
Dim StrAddr as string
If IsDBNull( DS.tables("tblName").rows(0).item("Address")) then
LbMsg.text =" No address entered."
else
StrAddr = DS.tables("tblName").rows(0).item("Address"))
end if
I have error msg : Can not cast DBNull to string.
All I wanted is to check the field address to see if it is empty or no data entered.
Please help.
How to check ? How to handle if the field has nothing in it at all. How to use IsDBNull() ?
Thanks in advance.
Try this:
StrAddr = DS.tables("tblName").rows(0).item("Address").ToString
If StrAddr ="" then StrAddr = "No Address Entered"
Tim
Labels: access, ado, connect, database, dataset, datatype, dbnull, dim, empty, field, function, handle, net, null
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home