Boolean data type in VS 2005
-
- Posts: 20
- Joined: Thu 31 Aug 2006 18:19
Boolean data type in VS 2005
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!
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!
-
- Posts: 12
- Joined: Thu 20 Jul 2006 15:01
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.
-
- Posts: 20
- Joined: Thu 31 Aug 2006 18:19
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.
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.
-
- Posts: 38
- Joined: Tue 07 Mar 2006 17:13