Database Connection

Results 1 to 2 of 2

Thread: Database Connection

  1. #1
    Sharon Guest

    Default Database Connection

    I am trying to establish a database connection using this code and it doesn&#039t work:<BR><BR>usesDSN = False<BR> <BR> &#039 Set up the variables if this site uses a DSN<BR> &#039<BR> dsnName = ""<BR> dsnUser = ""<BR> dsnPass = ""<BR> <BR> &#039 Set up the database path & name if it does not use a DSN<BR> &#039<BR> dbPath = Server.MapPath("\") & " b"<BR> &#039driver={microsoft access driver (*.mdb)}; dbq=f:inetpubstdevsharonblutchersharoncalander.mdb "<BR> &#039 -- END CUSTOMIZABLE AREA<BR><BR> &#039 Constants <BR> &#039<BR> Const C_STRING = 1<BR> Const C_NUM = 2<BR> <BR> &#039 Database Connection Settings<BR> &#039 Do not alter<BR> &#039<BR> Set dbConn = Server.CreateObject("ADODB.Connection") <BR> If usesDSN = False Then<BR> dbConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & dbPath<BR> Else<BR> dbConn.Open dsnName,dsnUser,dsnPass<BR> End If<BR><BR>Please help<BR><BR>Thanks

  2. #2
    Join Date
    Dec 1969

    Default RE: Database Connection

    Normally, the path to your database would be something like...<BR>f:inetpubwwwrootstdevsharonblutchershar oncalander.mdb<BR><BR>or<BR>f:inetpubstdevsharonbl utchersharoncalander.mdb<BR><BR>dbPath = Server.MapPath("\") & " b"<BR><BR>will probably yield...<BR><BR>f:inetpubwwwrootdbq=f:inetpubstdev sharonblutchersharoncalander.mdb<BR><BR>You don&#039t need dbq= in this kind of connection string, nor do you need the server.mappath("\") since you&#039re providing a full path string.<BR><BR>Did your date question get answered correctly yesterday??

Posting Permissions

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