retrieve values from .mdb

  • Thread starter Thread starter DL
  • Start date Start date
D

DL

Hi,

I tried searching the internet but since I'm quite new to VB I can't seem to
find a clear anwer to my question:

I have a access .mdb database file and I want to use it in my application.
I'm using visual studio 2003, so i guess I'm using the framework .Net v1.1
(?)

Ho do I connect to a database file called er.mdb (no passwords yet on the
db)
and retrieve values from a table called "studies".
If possible I would like them placed in listbox1.

Thanks,

Daniel
 
Hi,

DL said:
Hi,

I tried searching the internet but since I'm quite new to VB I can't seem
to
find a clear anwer to my question:

I have a access .mdb database file and I want to use it in my application.
I'm using visual studio 2003, so i guess I'm using the framework .Net v1.1
(?)
Yes.


Ho do I connect to a database file called er.mdb (no passwords yet on the
db)
and retrieve values from a table called "studies".
If possible I would like them placed in listbox1.

I suggest you to start reading, for example, you might start by reading
about data access (ado.net) in .net help file.
This would be a good start.
 
Yes what you are trying to do is very possible.

You need the System.Data.OleDb namespace to do what you are trying to do.
For VS2003, you are probably talking about VB.NET for which you would need
to use ADO.NET. There are plenty of books written on ADO.NET including mine,
and any of those is a good way to get started on ADO.NET.

The objects specifically that you could be interested in could be ---

System.Data.Dataset <-- this can hold your data
System.Data.OleDb.OleDbDataAdapter <--- this can fill your dataset.
System.Data.OleDb.OleDbCommand <--- this holds the sql command (sort of)
System.Data.Oledb.OleDbConnection <--- this establishes a connection to the
mdb file.
System.Data.OleDb.OleDbDataReader <--- an alternate simpler way to use
instead of DataSet (might work better for your situation).

Fire up MSDN, and look up these objects :)

- Sahil Malik
You can reach me thru my blog -
http://www.dotnetjunkies.com/weblog/sahilmalik
 
Hmmm...In my previous post, the URL I pasted didn't link to where I thought
it would, but it will get you close. About 26 items below that article, in
the list at the left, is an article titled, "Walkthrough: Editing an Access
Database with ADO.NET." That's the one I was trying to link to.
 
Back
Top