Discussion Locked

Connecting VB.Net to an Access Database

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

If someone could please send me code that I can use to connect an Access Database in VB.Net. I would greatly appreciate it. I need to be able to add delete and update from a form.

Thanks,
Mike Mangel
wxdk@iup.edu

2 replies

by aaroncool

Dim oODBCConnection As OdbcConnection
Dim sConnString As String = _
"Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=C:\Test.mdb;" & _
"Pwd=Password"
oODBCConnection = New Odbc.OdbcConnection(sConnString)
oODBCConnection.Open()

Dim odr As OdbcDataReader
Dim cmd As New OdbcCommand()
cmd.Connection = oODBCConnection

cmd.CommandText = "SELECT * FROM Log"

odr = cmd.ExecuteReader()

odr.Read()

MsgBox(odr("LogID").ToString())

This discussion is closed to new replies.