I have a MySQL Table, one of the columns' Data Type is TinyInt(1)
When I use this line of code it gives an error
int newNumber = int.Parse(string.Format("{0}", reader["someField"])
I think the reader is reading a bool value
however MySQL Table has row values of 0 & 1 & 6 & 7
so it is not bool true/false type
How can I actually grab that value to store into "int newNumber"
Thanks

Sam HobbsRank #108 · 20.5K reputationPosted Aug 14, 2011, 4:02 PM EDT
You should determeine for sure what ype of data that reader["someField"] is. How is it defined for MySQL?
David Chen60 reputationPosted Aug 14, 2011, 5:36 PM EDT
Sam HobbsRank #108 · 20.5K reputationPosted Aug 14, 2011, 6:13 PM EDT
David Chen60 reputationPosted Aug 14, 2011, 6:57 PM EDT
David Chen60 reputationPosted Aug 14, 2011, 7:15 PM EDT
bool newNumber = (bool)reader["newField"]
newNumber returns false or true
thats because in that column I have 0, 1, 4, 6 ,7
Sam HobbsRank #108 · 20.5K reputationPosted Aug 14, 2011, 7:50 PM EDT
David Chen60 reputationPosted Aug 14, 2011, 8:01 PM EDT
Sam HobbsRank #108 · 20.5K reputationPosted Aug 14, 2011, 8:19 PM EDT
David Chen60 reputationPosted Aug 15, 2011, 10:22 AM EDT
int newNumber = Convert.ToInt32(reader["abcd"]);
Console.WriteLine(newNumber);
print out 6
problem has to do with the select statement by adding " (newNumber+0)" then everything is ok