How to tell the difference of Null value or true or false for Yes/No field in access database from vb.net
-
Hi, dear all, I create a database using Access database. There are some fields with data type Yes/No, I want to know to tell the difference of Null and False. Right now even if I never set value for these field, they return false to me. I wants to clarify the difference. I use the following code, but doesn't work, suppose I have a field called Marriage which is type Yes/No. if user never fill in value for it, it should return Null, otherwise, return true or false Dim obj as Object obj = ResultSet.Tables(0).Rows(0).Item("Marriage") If IsDBNull(obj) Then return Nothing ElseIf obj.ToString() = "True" Then return True Else return False End If it always reutrn "False" to me. Thanks!
-
Hi, dear all, I create a database using Access database. There are some fields with data type Yes/No, I want to know to tell the difference of Null and False. Right now even if I never set value for these field, they return false to me. I wants to clarify the difference. I use the following code, but doesn't work, suppose I have a field called Marriage which is type Yes/No. if user never fill in value for it, it should return Null, otherwise, return true or false Dim obj as Object obj = ResultSet.Tables(0).Rows(0).Item("Marriage") If IsDBNull(obj) Then return Nothing ElseIf obj.ToString() = "True" Then return True Else return False End If it always reutrn "False" to me. Thanks!
I hope you were smart enough and googled your question. an adequate suggestion is readily available. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
-
I hope you were smart enough and googled your question. an adequate suggestion is readily available. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
I search from google first, but didn't find any answer.
-
I hope you were smart enough and googled your question. an adequate suggestion is readily available. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
for decimal data type, everything is ok, only for Yes/No data type, if you didn't set value for it, it return False to you.
-
for decimal data type, everything is ok, only for Yes/No data type, if you didn't set value for it, it return False to you.
That is correct; if you don't like it, use something else. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.