Connection to Access database

Results 1 to 2 of 2

Thread: Connection to Access database

  1. #1
    Join Date
    Dec 1969

    Default Connection to Access database

    I don&#039;t have a problem connecting to DB2 database, but when I tried to connect to the MS Access database, that is on my root folder (PWS) I got runtime error - saying that &#039;Object required&#039;. Please could someone tell me what is wrong with this code? I tried with &#039;dsn&#039; - doesn&#039;t help. When I make this connection using Dreamweaver tools - no problem, I can retrieve data from database, but the same connection doesn&#039;t work with ASP. Please help!<BR><BR>set cnSlika = Server.CreateObject("ADODB.Connection")<BR>cnSlika = "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:InetpubwwwrootB&CWEBFBPSclientdb1.m db"<BR>cnSlika.Open<BR>strSQL = "Select * from Table2;"<BR>set employees = Server.CreateObject("ADODB.Recordset")<BR>set employees = cnSlika.Execute(strSQL)<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Connection to Access database

    for a start, you don&#039;t need this line :<BR><BR>&#062; set employees = Server.CreateObject("ADODB.Recordset")<BR><BR>beca use connection.execute implicitly returns a recordset object. that line is just wasted<BR><BR>these two lines are wrong :<BR><BR>&#062; cnSlika = "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:InetpubwwwrootB&CWEBFBPSclientdb1.m db"<BR>&#062; cnSlika.Open<BR><BR>try this :<BR><BR>strSlika = "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:InetpubwwwrootB&CWEBFBPSclientdb1.m db"<BR>cnSlika.Open strSlika<BR><BR>j<BR>

Posting Permissions

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