View Single Post
Join Date: May 2005
Posts: 12
Reputation: Robert Walker is an unknown quantity at this point 
Solved Threads: 0
Robert Walker Robert Walker is offline Offline
Newbie Poster

Re: connecting to access via vb.net-HELP!!!

 
0
  #7
May 17th, 2005
Here's what I did

myPath = "c:\Table.mdb"
myQuery = "select * from table"

Public Function Return_Access(ByVal myQuery As String, ByVal myPath As String) As DataSet
Dim myConnStr As String = "Provider=Microsoft.jet.OLEDB.4.0;Data Source=" + myPath
Dim myConn As New OleDb.OleDbConnection(myConnStr)
Dim myAdapt As New OleDb.OleDbDataAdapter(myQuery, myConn)

Try
myConn.Open()
Dim myReader As New DataSet
myAdapt.Fill(myReader)
Return myReader
myConn.Close()

Catch ex As Exception
MessageBox.Show(ex.Message)
End Try

End Function
Reply With Quote