Database Connection Problem

Results 1 to 2 of 2

Thread: Database Connection Problem

  1. #1
    Leigh Dragoon Guest

    Default Database Connection Problem

    Can someone please tell me what I&#039m doing wrong? I&#039m trying to access an Access (no pun intended) database, located on my C drive. My ASP pages are residing on a server separate from my work station. I don&#039t know if this matters or not. I&#039m really stumped, and it&#039s driving me crazy! If someone could please help me, I&#039d be grateful.<BR><BR>&#060;%<BR> set ConnObj = Server.CreateObject("ADODB.Connection")<BR> ConnObj.ConnectionTimeout = 15<BR> ConnObj.Open "c:databasesGuestbook97.mdb"<BR> ConnObj.CommandTimeOut = 30<BR>%&#062;<BR><BR>&#060;%<BR> set ConnObj = Server.CreateObject("ADODB.Connection")<BR> ConnObj.Mode = adModeWrite<BR> ConnObj.Open "driver = {Microsoft Access Drive (*.mdb)};dbq= c:databasesGuestbook97.mdb"<BR> Line1 = "INSERT INTO tblguestbook (fname,lname,phone,"<BR> Line2 = "email, homepage, dateadded) VALUES (&#039your first name&#039,"<BR> Line3 = "&#039your last name&#039, &#039your phone&#039, &#039your email&#039,"<BR> Line4 = "&#039your homepage&#039,&#039" & now()& "&#039)"<BR> CommandText = Line1 & Line2 & Line3 & Line4<BR> ConnObj.Execute CommandText, RecordsAffected, adCmdText %&#062;<BR><BR>&#060;html&#062;<BR>&#060;%= RecordsAffected%&#062; records(s) were added successfully!<BR>&#060;/html&#062;<BR>&#060;%ConnObj.Close%&#062;

  2. #2
    Cable Guest

    Default RE: Database Connection Problem

    It is very simple, make sure that you copy the database to the server and use the path to the database from the Server Point Of View. That is if the database is copied to \serverc_rootaccess use the local server path "c:accessGuestbook97.mdb" if it is \serverd_rootuserspublic_htmlleighd use "d:userspublic_htmlleighdGuestbook97.mdb"<BR><BR>A SP can only access local hard drives, not networked ones. So it cannot reference files on your local workstation hard drive. <BR><BR>I hope this helps.<BR><BR>http://www.normad.com/asphelp.html<BR><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
  •