Solved

Access Database

Posted on 2004-10-05
7
244 Views
Last Modified: 2012-05-05
How do I connect, read and display the contents of a Access database ie: file.mdb
Thanks
0
Comment
Question by:Mylor
7 Comments
 
LVL 16

Expert Comment

by:RobertRFreeman
ID: 12228414
Use the data form wizard project.

From your solution add a new data form project.  It will prompt you for all the settings.
0
 
LVL 16

Expert Comment

by:RobertRFreeman
ID: 12228432
sorry,

From your VB Project, add a new data form wizard item.
0
 
LVL 16

Expert Comment

by:RobertRFreeman
ID: 12228453
Use Microsoft Jet 4.0 for your provider when setting up the connection.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Accepted Solution

by:
bramsquad earned 250 total points
ID: 12228561
   Dim conn As OleDbConnection
    Dim adpt As OleDbDataAdapter

    Dim cstring, sql As String

    'connect
    cstring = "Provider=Microsoft.JET.OLEDB.4.0;Data Source=C:\The\Path\To\File.mdb;"
    sql = "SELECT * FROM YourFavoriteTable;"

    conn = New OleDbConnection(cstring)
    adpt = New OleDbDataAdapter(sql, conn)
    adpt.Fill(ds, tblName)    

    'read and display in a datagrid
    dgTable.DataSource = ds.Tables("YourFavoriteTable").DefaultView
    dgTable.Refresh()

~b
0
 

Author Comment

by:Mylor
ID: 12228615
Hi Bramsquad, what reference do I need to import?
Thanks,
0
 
LVL 4

Expert Comment

by:srcalc
ID: 12229034
System.Data.OleDb
0
 

Author Comment

by:Mylor
ID: 12229063
Thanks !
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question