Boolean data type in VS 2005

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
mr breaker
Posts: 20
Joined: Thu 31 Aug 2006 18:19

Boolean data type in VS 2005

Post by mr breaker » Tue 12 Sep 2006 16:12

Hi,

I have a stored procedure that has IN parameters of type "boolean" or "tinyint(1)". (I say "or" because I have tried this with both types of declarations)

I am using VS Studio 2005. I create a table adapter using the Table Adapter Wizard, and it sets the parameters as datatype "tinyint".

When I try to call the stored procedure through the table adapter in code, I pass it a boolean value, true or false. This gives me an ASP error:

Out of range value adjusted for column 'MyColumnName' at row 1


If I pass it a 0 or 1 it works. Is there a way to pass it true or false though? I would prefer that my code is not database dependent.


Thanks!

jcrabtreesla
Posts: 12
Joined: Thu 20 Jul 2006 15:01

Post by jcrabtreesla » Tue 12 Sep 2006 18:14

I don't know how you pass your value... But in the past I have used drop down lists and the text displayed would be True or False, but I have always had to pass a 0 or 1 (assign the value of the drop down) no matter what datatype is in the DB. I have always refrained from using pure boolean values, rather tinyint(1) or char(1). My experience though, someone else may have a more correct answer.

mr breaker
Posts: 20
Joined: Thu 31 Aug 2006 18:19

Post by mr breaker » Tue 12 Sep 2006 18:28

I'm just trying to pass values to through a table adapter, such as:


dim da as new ReportTableAdapter
da.GetReportData(true, '206-09-12')


But this will not work unless I pass a 0 or 1 instead of true or false.


It's not the end of the world if I use 0/1, but it would be nice to be consistent and use true/false.

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Wed 13 Sep 2006 10:15

Could you please send me your project to reproduce the problem. Include definitions of your own database objects. Do not use third party components. Use e-mail address provided in the Readme file.

mr breaker
Posts: 20
Joined: Thu 31 Aug 2006 18:19

Post by mr breaker » Wed 13 Sep 2006 14:02

I sent it to mysqlnet at crlab.com

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Wed 13 Sep 2006 14:38

OK, it will be forwarded to me soon.

[email protected]
Posts: 38
Joined: Tue 07 Mar 2006 17:13

Post by [email protected] » Wed 20 Sep 2006 14:44

Could it be that the VS Boolean type is treating false as zero and true as negative one? If your db is expecting an unsigned tinyint then the negative one would throw an exception.

You could try creating your own Boolean Enum and force True to positive one and see if it works...

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Thu 21 Sep 2006 07:59

Dear, mr breaker, i haven't received your mail yet. Please re-sent it to me directly (i've sent you initial letter to deafmexicans98 at hotmail dot com).

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Thu 21 Sep 2006 08:16

Your server rejects my letters. I think our mail server do the same with yours, that's why we still haven't received your test project. Please
re-sent it to me directly (AlexeyI at crlab dot com) using another e-mail address.

Post Reply