Getting Data From / Adding Data To Access DB Table

  • Thread starter Thread starter ags5406
  • Start date Start date
A

ags5406

I've looked at lots of solutions for this but I must say that I'm
thoroughly confused.

VB2005...

Let's say I've created a table in an access database called Table1
that has two columns and three records.

So the table looks like...

A 1
B 2
C 3

I want to get the data from that table into two arrays - a string
array and an integer array.

I've gone to the solution explorer, right click on project name, add
existing item, access_file.mdb, ...

In data sources I can see access_fileDataSet, and under that I can
see the table Table1. I can right click on Table1 and preview the
data. But I cannot for the life of me figure out how to get this into
an array.

Any help is greatly appreciated.
 
ags5406 said:
I've looked at lots of solutions for this but I must say that I'm
thoroughly confused.

VB2005...

Let's say I've created a table in an access database called Table1
that has two columns and three records.

So the table looks like...

A 1
B 2
C 3

I want to get the data from that table into two arrays - a string
array and an integer array.

I've gone to the solution explorer, right click on project name, add
existing item, access_file.mdb, ...

In data sources I can see access_fileDataSet, and under that I can
see the table Table1. I can right click on Table1 and preview the
data. But I cannot for the life of me figure out how to get this
into an array.

Any help is greatly appreciated.


In short: Build a connection to the database, use an OleDbCommand and SQL
select command to query the data, use a OleDbDatareader to read the data in
a loop and put them into an array - but you should learn it from the start:
http://msdn2.microsoft.com/en-us/library/e80y5yhx.aspx


Armin
 
Back
Top