Results 1 to 3 of 3

Thread: Need Help For Connection About VB 2005 TO Access2003

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2006
    Posts
    2

    Need Help For Connection About VB 2005 TO Access2003

    I Can't Conncect VB 2005 to Access2003
    When I Click Data And Add New Connection Then I Choose MS Access Database But It Doesn't Show Browse For Me [IMG]C:\Documents and Settings\akaphoome_t\Desktop\Problem VB\1.jpg[/IMG] [IMG]C:\Documents and Settings\akaphoome_t\Desktop\Problem VB\2.jpg[/IMG]

    Who Can Bring Form of Add New Connection Back

  2. #2

    Thread Starter
    New Member
    Join Date
    Dec 2006
    Posts
    2

    Re: Need Help For Connection About VB 2005 TO Access2003


  3. #3
    Frenzied Member
    Join Date
    Aug 2005
    Posts
    1,042

    Re: Need Help For Connection About VB 2005 TO Access2003

    needforu:

    You could try doing it in your code like this:

    To programmatically create a connection between your application and an Access database

    The following code creates an OleDbConnection object, sets the OleDbConnection.ConnectionString property, and opens the connection.

    VB Code:
    1. Public Sub ConnectToAccess()
    2.     Dim conn As New System.Data.OleDb.OleDbConnection()
    3.     ' TODO: Modify the connection string and include any
    4.     ' additional required properties for your database.
    5.     conn.ConnectionString = & _
    6.     "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & _
    7.     "C:\Documents and Settings\username\My Documents\dbFile.mdb"
    8.     Try
    9.        conn.Open()
    10.        ' Insert code to process data.
    11.     Catch ex As Exception
    12.        MessageBox.Show("Failed to connect to data source")
    13.     Finally
    14.        conn.Close()
    15.     End Try
    16. End Sub

    Hope this help.

    Good Luck

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width