General discussion

  • Creator
    Topic
  • #2278315

    Connecting VB.Net to an Access Database

    Locked

    by wxdk ·

    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

All Comments

  • Author
    Replies
    • #2465646

      Try using imports System.Data.ODBC

      by aaroncool ·

      In reply to Connecting VB.Net to an Access Database

      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())

    • #2969335

      Check this link

      by chekuru.murali ·

      In reply to Connecting VB.Net to an Access Database

Viewing 1 reply thread