CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2000
    Location
    UAE
    Posts
    15

    ActiveX Data Object(database connection)

    If the database is password protected than what changes are to be made in the syntaxes below.Please give the full syntax for connecting to databasehaving password......


    Dim db As ADODB.Connection
    Dim rs As ADODB.Recordset

    Private Sub Form_Load()
    Dim sql As String
    Set db = New ADODB.Connection
    Set rs = New ADODB.Recordset
    db.ConnectionString =
    "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=C:\Access\Studentdata.mdb"
    db.Open
    sql = "select * from student"
    rs.Open sql, db, adOpenStatic
    End Sub



  2. #2
    Join Date
    Jan 2000
    Location
    MO, USA
    Posts
    1,506

    Re: ActiveX Data Object(database connection)

    Just append the password parameter to the end:

    db.ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=C:\Access\Studentdata.mdb;Password=yourpwd;"
    db.Open




    that should do it.

    John

    John Pirkey
    MCSD
    http://www.ShallowWaterSystems.com
    http://www.stlvbug.org
    John Pirkey
    MCSD (VB6)
    http://www.stlvbug.org

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

Featured