473,396 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

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.
Nov 16 '05 #1
4 3539
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" <ms****@dodo.com> wrote in message
news:ur**************@tk2msftngp13.phx.gbl...
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.

Nov 16 '05 #2
No, the code I am using to read data from the database is:

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

"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:ud**************@TK2MSFTNGP10.phx.gbl...
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" <ms****@dodo.com> wrote in message
news:ur**************@tk2msftngp13.phx.gbl...
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.


Nov 16 '05 #3
Try with GetBoolean method or with "1".

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

"Martin" <ms****@dodo.com> wrote in message
news:ew**************@TK2MSFTNGP14.phx.gbl...
No, the code I am using to read data from the database is:

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

"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:ud**************@TK2MSFTNGP10.phx.gbl...
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" <ms****@dodo.com> wrote in message
news:ur**************@tk2msftngp13.phx.gbl...
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.



Nov 16 '05 #4
Got it! Thanks!
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Try with GetBoolean method or with "1".

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

"Martin" <ms****@dodo.com> wrote in message
news:ew**************@TK2MSFTNGP14.phx.gbl...
No, the code I am using to read data from the database is:

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

"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:ud**************@TK2MSFTNGP10.phx.gbl...
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" <ms****@dodo.com> wrote in message
news:ur**************@tk2msftngp13.phx.gbl...
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.



Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: John | last post by:
I have over 5000 thumbnail pictures of size 5kb each. I would like to able to load all 5000 pictures and view 50 per page using mysql_data_seek(). I would like to know what are the advantages and...
3
by: Dariusz | last post by:
I have been reading a little that you should secure your PHP code to prevent SQL injection into a database (MySQL in my instance), mainly by checking the type of data to be put into a database, and...
6
by: andrew blah | last post by:
Hello I have recently released catchmail - a free (BSD license) open source Python utility www.users.bigpond.net.au/mysite/catchmail.htm This script processes in and outbound emails and stores...
22
by: Martin MOKREJ© | last post by:
Hi, I'm looking for some easy way to do something like include in c or PHP. Imagine I would like to have: cat somefile.py a = 222 b = 111 c = 9
7
by: Jim Ford | last post by:
I have the following code: A * F(B * x) { A * y = (A *) *x->data ; return y ; } Is this legal? Do you need more information about the details of the A
15
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to...
0
by: Kofi | last post by:
Hi All, I have very recently inherited a project which includes a C# and SQL Server application I have to decipher and propose enhancements and new structural changes. The original developers...
3
by: josh.kuo | last post by:
Sorry about the subject, I can't think of a better one. I recently wrote some PHP classes that I think might be of interest to this group. Since I have been reaping the benefits of reading news...
2
by: Ed | last post by:
Hope someone can help me out... I have been tasked to read some image data from an sql database and save the files to flat files. OK, sounds easy as I'v used BLOBs before. But this is an old...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.