Page 1 of 1

Boolean evaluation in VB.NET ?

Posted: Sat 14 Jan 2006 11:44
by bumasoft
I've got a problem evaluating boolean values from the mysql db.

drowUserRights.Item("blnBookRead") = True Ths line doesn't work
drowUserRights.Item("blnBookRead") = 1 This line works

Why can't I us VB.NET's Boolean for evaluationg a boolean value from the db.

The blnBookRead-fieldtype is: TINYINT(1)

regards
bumasoftware

Posted: Mon 16 Jan 2006 12:44
by Serious
TINYINT fields are fetched as Int16 values.
To recognize column types returned by query use MySqlDataReader.GetSchemaTable() method.

Posted: Mon 16 Jan 2006 14:55
by bumasoft
Ok I get that. But does that mean that each time I need to fill a dataset, I first have to use the GetSchemaTable and convert it in to a dataset. That is gonna cost valuable seconds. Why does it Work with an Access database - is it because a boolean is stored different here ??

Posted: Mon 16 Jan 2006 15:14
by Serious
But does that mean that each time I need to fill a dataset, I first have to use the GetSchemaTable and convert it in to a dataset.
You're wrong. We advise to use GetSchemaTable method (or appropriate feature of MySqlDataAdapter/MySqlDataTable designer) at the coding stage, not when your application runs. The process should represent something like this: you create tables in db, create queries in designer, check result set metadata (schema table) and take decision about types you should use in the code.
Why does it Work with an Access database - is it because a boolean is stored different here ??
This behavior is caused by MySQL protocol.