Results 1 to 6 of 6

Thread: sql connectionstring for mdb database ?[Resolved]

  1. #1

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

    sql connectionstring for mdb database ?[Resolved]

    Can I use this to connect to mdb database ?? if yes , how ?

    Code:
    myConnection.ConnectionString = "Persist Security Info=False;Integrated  
    Security=SSPI;database=northwind;server=mySQLServer;Connect Timeout=30";
    edit : I mean where do I have to put the path and password if it's protected ?

    Thanks
    Last edited by Pirate; Jun 27th, 2003 at 02:38 PM.

  2. #2
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    The connectionstring above is to SQL Server not an Access mdb database.

    try this

    For OLEDB Connection
    VB Code:
    1. Dim oOleDbConnection As OleDb.OleDbConnection
    2. Dim sConnString As String = _
    3.          "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    4.          "Data Source=C:\myPath\my.mdb;" & _
    5.          "User ID=;" & _
    6.          "Password="
    7. oOleDbConnection = New OleDb.OleDbConnection(sConnString)
    8. oOleDbConnection.Open()

    For ODBC Connection
    VB Code:
    1. Dim oODBCConnection As Odbc.OdbcConnection
    2. Dim sConnString As String = _
    3.          "Driver={Microsoft Access Driver (*.mdb)};" & _
    4.          "Dbq=c:\somepath\mydb.mdb;" & _
    5.          "Uid=;" & _
    6.          "Pwd="
    7. oODBCConnection = New Odbc.OdbcConnection(sConnString)
    8. oODBCConnection.Open()
    Last edited by Memnoch1207; Jun 27th, 2003 at 02:18 PM.
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

  3. #3

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    I know it's for SQL but I was wondering if I can use SqlConnection object instead of OleDbConnection to open mdb database . Is this possible ???

  4. #4
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    AFAIK, no you can't...The OleDbConnection object can be used to with either SQL Server or Access, but SqlConnection object can only be used for SQL Server.
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

  5. #5
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Reading, UK
    Posts
    870
    i'll back that up as well. SQLclient namespace stuff can only be used with SQL sever 7 and 2000
    www.vb-tech.com
    .Net Freelance Development
    http://weblog.vb-tech.com/nick
    My blog

  6. #6

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    oh damn ,

    Thanks guys.

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