Link to home
Start Free TrialLog in
Avatar of rwensley
rwensleyFlag for United States of America

asked on

Read SQLite Field into a variable in VB.net

Greetings,

I need to read a field from a record in SQLite into a variable in VB.net.
Many examples exist for reading into a textbox, combobox, listbox, or datagrid.  But I can not find an example of reading into a variable.

ie.  A = column 1 of the table at row 1 (Column 1 is a BOOLEAN)
B = column 2 of the table at row 1 (Column 2 is a FLOAT)

I have thought of reading the values into an 'invisible' textbox then dealing with them, but this is very sloppy and not the way I want to proceed.

Thanks for the Help,
Ron
Avatar of rwensley
rwensley
Flag of United States of America image

ASKER

I am using this code and have verified that the field in the database is a BOOLEAN data type

There are no errors when it runs, however the _bool is always False even when the field value is True

SQLcommand.CommandText = "SELECT fc_calibrated_meter FROM flowcalcs WHERE fc_tag='" & cmbFCTag.Text & "'"
        Dim _bool As Boolean = CType(SQLcommand.ExecuteScalar(), Boolean)
        TextBox1.Text = _bool

Any ideas are welcome
Ron
NOTE: These text box is for displaying the value only.  I want the variable -bool to be used elsewhere in the program.
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial