Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

unable to save to database!

Status
Not open for further replies.

immotal

Technical User
Sep 1, 2003
9
SG
hi.. I am unable to save data to database.the codes are below..It will give mi an error shown:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x9c Thread 0xa8c DBC 0x2185024 Jet'.
/project/b2/013974H/project/addcust.asp, line 28



<% Option Explicit %>
<%
dim err
dim conn
dim rs
dim strBuffer1,strBuffer2
dim varDatabaseName
dim sql

varDatabaseName=&quot;db2.mdb&quot;

On Error Resume Next
rs.close
conn.close
set rs = nothing
set conn = nothing
On Error Goto 0

set err = server.createobject(&quot;ADODB.error&quot;)

set conn = server.createobject(&quot;ADODB.connection&quot;)
conn.open &quot;DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=&quot; & Server.MapPath(varDatabaseName)
set rs = server.createobject(&quot;ADODB.recordset&quot;)
rs.CursorType = 2
rs.LockType = 3

dim s
s = &quot;Select * from customer&quot;
rs.open s,conn '&quot;customer&quot;, conn, adLockOptimistic, ,adCmdTable

rs.AddNew
rs(&quot;firstname&quot;)=Request.Form(&quot;firstname&quot;)
rs(&quot;lastname&quot;)=Request.Form(&quot;lastname&quot;)
rs(&quot;delivery&quot;)=Request.Form(&quot;delivery&quot;)
rs(&quot;town&quot;)=Request.Form(&quot;town&quot;)
rs(&quot;country&quot;)=Request.Form(&quot;country&quot;)
rs(&quot;contact&quot;)=Request.Form(&quot;contact&quot;)
rs(&quot;fax&quot;)=Request.Form(&quot;fax&quot;)
rs(&quot;email&quot;)=Request.Form(&quot;email&quot;)
rs(&quot;credit&quot;)=Request.Form(&quot;credit&quot;)
rs(&quot;creditcardnum&quot;)=Request.Form(&quot;creditcardnum&quot;)
rs(&quot;expire&quot;)=Request.Form(&quot;expire&quot;)
rs(&quot;cardholdername&quot;)=Request.Form(&quot;cardholdername&quot;)
rs.Update

response.write &quot;Saved!&quot;
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
<html>

<head>
<title>customerInformation</title>
</head>

<body>

<h3>This information has been saved.</h3>
</body>
</html>


thx for ur help..
 
The database file does not exist. I got that often before and that was it.
It could be some Server.MapPath(varDatabaseName) error, better display that value and see if it's the real path to database. As i see from your code the db2.mdb should be in the same directory as the asp file.

________
George, M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top