whittlephilip
asked on
boolean field check
How to check if field in access database is set to true or false through code? For example, I would like to do something like ..
if field = true then
... perform some action
end if
if field = true then
... perform some action
end if
ASKER
Hi amyhxu
I appreciate your attempt to help me. At run time I kept getting the error message saying there was no row at position 0.
At this point I really don't care ;-) This was so much easier in VB6, and can't understand why its become so complex. I guess I'll stick with vb6.
I appreciate your attempt to help me. At run time I kept getting the error message saying there was no row at position 0.
At this point I really don't care ;-) This was so much easier in VB6, and can't understand why its become so complex. I guess I'll stick with vb6.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi amyhxu
Good tip. If I may elaborate, I am making headway, thanks to your tip. But I do have one more piece to this question. In the dRow declaration
-- Dim dRow as DataRow = mydataset.Tables("mydatata ble").Rows (rowIndex) --
Each rowIndex is called randomly by another function. How should I approach the rowIndex if it is random instead of fixed?
Thanks for you support.
Philip
Good tip. If I may elaborate, I am making headway, thanks to your tip. But I do have one more piece to this question. In the dRow declaration
-- Dim dRow as DataRow = mydataset.Tables("mydatata
Each rowIndex is called randomly by another function. How should I approach the rowIndex if it is random instead of fixed?
Thanks for you support.
Philip
ASKER
Hi ... I think I fixed my problem with random row selection.
if you use dataadapter to fill dataset:
Dim dRow as DataRow = mydataset.Tables("mydatata
If Not IsDbNull(dRow(BoolCol")) AndAlso dRow("BoolCol") Then 'same effect as "If Not IsDbNull(dRow(BoolCol")) AndAlso dRow("BoolCol") = True Then "
...
End If
If you use DataReader:
Dim dr as DataReader
'execute datareader
If NOT dr IS Nothing Then
If dr("BoolCol") Then 'Same as "If dr("BoolCol") = True Then"
....
End If