Again Difficulty in Connecting to Database

Results 1 to 2 of 2

Thread: Again Difficulty in Connecting to Database

  1. #1
    Terence Guest

    Default Again Difficulty in Connecting to Database

    O.K here is the code:<BR><BR>Dim objConn<BR>Set objConn = Server.CreateObject("ADODB.Connection")<BR><BR>Dim strConnString<BR><BR>strConnString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _<BR>Server.MapPath("db_scratch.mdb") & ";"<BR> <BR>strConnString = Application("SQLConnString")<BR><BR><BR>And Here is the insert part:<BR><BR>Set cnnFormToDB = Server.CreateObject("ADODB.Connection")<BR> cnnFormToDB.Open strConnString<BR><BR>strSQL = ""<BR>strSQL = strSQL & "INSERT INTO scratch "<BR>strSQL = strSQL & "(text_field, integer_field, date_time_field) " & vbCrLf<BR>strSQL = strSQL & "VALUES ("<BR>strSQL = strSQL & "&#039" & strTextField & "&#039"<BR>strSQL = strSQL & ", "<BR>strSQL = strSQL & intIntegerField<BR>strSQL = strSQL & ", "<BR>strSQL = strSQL & DATE_DELIMITER & datDateTimeField & DATE_DELIMITER<BR>strSQL = strSQL & ");"<BR><BR> <BR>cnnFormToDB.Execute strSQL, lngRecsAffected, adCmdText Or adExecuteNoRecords<BR><BR>cnnFormToDB.Close<BR><BR ><BR>Can anyone pleasse tell me why is it that I get this error message. <BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039 80004005&#039 <BR><BR>[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified <BR><BR>I really need help thank you.

  2. #2
    Maged Wahba Guest

    Default RE: Again Difficulty in Connecting to Database

    Try to set a relative path in the Server.MapPath(".....")<BR><BR>If your DB in the same folder with the ASP file set the path like that Server.MapPath("./xxx.mdb"), or if it is in a folder with the same level(have the same root) with ASP folder set the path like Server.MapPath("../dirName/xxx.mdb").<BR>and so on<BR><BR>Good luck

Posting Permissions

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