Setting and Retrieving MySQL BIT(1) datatype as boolean value

  • Thread starter Thread starter ng01
  • Start date Start date
N

ng01

What would the proper parameter statement be to insert a true or false
into a MySQL (version 5.1.31) BIT(1) field? Here is what I have:

Cmd.Parameters.Add("@USCurrency", OdbcType.Bit).Value = 0;

And what would be the proper select statement to retrieve a true or
false from that field?
Here is what I'm trying, but it always returns a True (when I browse
the datatable in the debugger):

DataTable dt = GetTable2("select USCurrency from tblquotesnew");

I've tried every OdbcType, with various values, both numeric and
string, to no avail. It always comes back True.

Thanks very much for any ideas.
 
What would the proper parameter statement be to insert a true or false
into a MySQL (version 5.1.31) BIT(1) field? Here is what I have:

Cmd.Parameters.Add("@USCurrency", OdbcType.Bit).Value = 0;

And what would be the proper select statement to retrieve a true or
false from that field?
Here is what I'm trying, but it always returns a True (when I browse
the datatable in the debugger):

DataTable dt = GetTable2("select USCurrency from tblquotesnew");

I've tried every OdbcType, with various values, both numeric and
string, to no avail. It always comes back True.

Thanks very much for any ideas.


Try DataTable dt = GetTable2("select USCurrency from tblquotesnew where
USCurrency = 1");
 
What would the proper parameter statement be to insert a true or false
into a MySQL (version 5.1.31) BIT(1) field? Here is what I have:

Cmd.Parameters.Add("@USCurrency", OdbcType.Bit).Value = 0;

And what would be the proper select statement to retrieve a true or
false from that field?
Here is what I'm trying, but it always returns a True (when I browse
the datatable in the debugger):

DataTable dt = GetTable2("select USCurrency from tblquotesnew");

I've tried every OdbcType, with various values, both numeric and
string, to no avail. It always comes back True.

Thanks very much for any ideas.
Hi there , I received your email ( you really should reply to the
newsgroup ) I don't know about MySQL, but in SQL server you can say
something along the lines of ( in your select statement ) : myfield =
Case USCurrency = 0 Then "N" Else "Y"
 
Back
Top