integra
04-08-2005, 06:54 PM
Hi all. Im having trouble adding records to my databse through SQL. Here's what I've got...
This page asks the user for some details.
<% ip = Request.ServerVariables("REMOTE_ADDR") %>
<html>
<head>
<title>Adding Records To An Access Data Base</title>
</head>
<body>
<form method="post" action="confirm.asp">
Name: <input type="text" name="name"> <BR><BR>
Comments: <BR><textarea cols="60" rows="15" name="comments"></textarea>
<BR>
<input type="submit" value="Submit"><input type="reset" value="Reset">
</form>
</body>
</html>
They then press submit, and the data should be added through this page...
<% ip = Request.ServerVariables("REMOTE_ADDR") %>
<html>
<head>
<title>Adding Records To An Access Data Base</title>
</head>
<body>
<%
'Create a connection to our database using a fileless dsn
Response.Buffer = true
dim cnn,rst
set cnn = Server.CreateObject("ADODB.Connection")
set rst = Server.CreateObject("ADODB.RecordSet")
cnn.Open "driver={Microsoft Access Driver (*.mdb)};;DBQ=blog.mdb;"
sqltext = "SELECT * FROM email"
rst.Open sqltext,cnn,3,3
'Server Side form validation to keep our database clean
dim namei,commentsi
namei = Request.Form("name")
commentsi = Request.Form("comments")
if namei = "" then
error = "You have not entered a name."
Response.Write error
Response.End
end if
'If we pass through validation then store the information in the db
rst.AddNew
rst("Entry_text") = commentsi
rst.update
'Lets redirect the user back to where they came from
Response.Redirect "insert.asp"
%>
</body>
</html>
But I just get an error when I click submit. Any idea where im going wrong?
P.S This is the error im getting...
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0xebc Thread 0x8c0 DBC 0x142639c Jet'.
/it2b/nbeedie/Blog/confirm.asp, line 14
Thanks! :)
This page asks the user for some details.
<% ip = Request.ServerVariables("REMOTE_ADDR") %>
<html>
<head>
<title>Adding Records To An Access Data Base</title>
</head>
<body>
<form method="post" action="confirm.asp">
Name: <input type="text" name="name"> <BR><BR>
Comments: <BR><textarea cols="60" rows="15" name="comments"></textarea>
<BR>
<input type="submit" value="Submit"><input type="reset" value="Reset">
</form>
</body>
</html>
They then press submit, and the data should be added through this page...
<% ip = Request.ServerVariables("REMOTE_ADDR") %>
<html>
<head>
<title>Adding Records To An Access Data Base</title>
</head>
<body>
<%
'Create a connection to our database using a fileless dsn
Response.Buffer = true
dim cnn,rst
set cnn = Server.CreateObject("ADODB.Connection")
set rst = Server.CreateObject("ADODB.RecordSet")
cnn.Open "driver={Microsoft Access Driver (*.mdb)};;DBQ=blog.mdb;"
sqltext = "SELECT * FROM email"
rst.Open sqltext,cnn,3,3
'Server Side form validation to keep our database clean
dim namei,commentsi
namei = Request.Form("name")
commentsi = Request.Form("comments")
if namei = "" then
error = "You have not entered a name."
Response.Write error
Response.End
end if
'If we pass through validation then store the information in the db
rst.AddNew
rst("Entry_text") = commentsi
rst.update
'Lets redirect the user back to where they came from
Response.Redirect "insert.asp"
%>
</body>
</html>
But I just get an error when I click submit. Any idea where im going wrong?
P.S This is the error im getting...
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0xebc Thread 0x8c0 DBC 0x142639c Jet'.
/it2b/nbeedie/Blog/confirm.asp, line 14
Thanks! :)