Click here to Skip to main content
11,502,348 members (63,405 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
Hi

Im new to VB. In delphi it was simple to read a mdb file
I added an "ado query" and a table. Linked them together.
The code i used was

ado.active := false
ado.sql.text := "select * from table"
ado.active := true

It was 3 lines of code to read a database and put it into a table.

Is there no simple method like this to open a mdb file in vb?
Posted 24-Apr-12 21:57pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

If you look back at your delphi work it wasn't quite that simple - you had to specify the DB, and set up a connection as well.
It is the same with VB:
Using con As New SqlConnection(strConnect)
	con.Open()
	Using da As New SqlDataAdapter("SELECT * FROM myTable", con)
		Dim dt As New DataTable()
		da.Fill(dt)
		myDataGridView.DataSource = dt
	End Using
End Using
That not only fills a table, but also displays it as well...
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You need to use ADO.NET classes to read data from access
Some useful classes r as folows
OleDbConnection
OleDbDCommand


Check this link

http://msdn.microsoft.com/en-us/library/ms971485.aspx[^]

Best of luck........
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Hi,

For reading Access file from VB.NET code, see the following link:

http://www.startvbdotnet.com/ado/msaccess.aspx[^]
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web04 | 2.8.150520.1 | Last Updated 25 Apr 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100