Boolean evaluation in VB.NET ?

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
bumasoft
Posts: 3
Joined: Sat 14 Jan 2006 11:41

Boolean evaluation in VB.NET ?

Post by bumasoft » Sat 14 Jan 2006 11:44

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

Serious

Post by Serious » Mon 16 Jan 2006 12:44

TINYINT fields are fetched as Int16 values.
To recognize column types returned by query use MySqlDataReader.GetSchemaTable() method.

bumasoft
Posts: 3
Joined: Sat 14 Jan 2006 11:41

Post by bumasoft » Mon 16 Jan 2006 14:55

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 ??

Serious

Post by Serious » Mon 16 Jan 2006 15:14

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.

Post Reply