C# code for reading assess database yes/no data type

  • Thread starter Thread starter Martin
  • Start date Start date
M

Martin

Can anyone perhaps tell me what C# code to use to read data from an Access
Database of yes/no data type?

I can read all the database columns except columns of yes/no type. When
trying to read yes/no data type, I get:

System.IndexOutOfRangeException:

Any help will be appreciated.

Martin.
 
Did you try using System.Data.OleDb.OleDbType.Boolean, size=2 and boolean
type for DataColumn?
 
No, the code I am using to read data from the database is:

if("True" == objReader["approved"].ToString())



Miha Markic said:
Did you try using System.Data.OleDb.OleDbType.Boolean, size=2 and boolean
type for DataColumn?


--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com

Martin said:
Can anyone perhaps tell me what C# code to use to read data from an
Access Database of yes/no data type?

I can read all the database columns except columns of yes/no type. When
trying to read yes/no data type, I get:

System.IndexOutOfRangeException:

Any help will be appreciated.

Martin.
 
Try with GetBoolean method or with "1".

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com

Martin said:
No, the code I am using to read data from the database is:

if("True" == objReader["approved"].ToString())



Miha Markic said:
Did you try using System.Data.OleDb.OleDbType.Boolean, size=2 and boolean
type for DataColumn?


--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com

Martin said:
Can anyone perhaps tell me what C# code to use to read data from an
Access Database of yes/no data type?

I can read all the database columns except columns of yes/no type. When
trying to read yes/no data type, I get:

System.IndexOutOfRangeException:

Any help will be appreciated.

Martin.
 
Got it! Thanks!


Miha Markic said:
Try with GetBoolean method or with "1".

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com

Martin said:
No, the code I am using to read data from the database is:

if("True" == objReader["approved"].ToString())



Miha Markic said:
Did you try using System.Data.OleDb.OleDbType.Boolean, size=2 and
boolean type for DataColumn?


--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com

Can anyone perhaps tell me what C# code to use to read data from an
Access Database of yes/no data type?

I can read all the database columns except columns of yes/no type. When
trying to read yes/no data type, I get:

System.IndexOutOfRangeException:

Any help will be appreciated.

Martin.
 
Back
Top