Solved

Access Database

Posted on 2004-10-05
7
211 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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

708 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now