PDA

View Full Version : Problems updating database


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! :)

mehere
04-08-2005, 07:38 PM
Either you are trying to open a db for which, the IUSR account has no rights to or the Db path is just wrong.

1) Check your db path and make sure it's correct.
2) Make sure that the IUSR account has read/write permissions to your db.

integra
04-08-2005, 07:52 PM
What does IUSR mean? Also, I tried it a different way and got a little further. This time when I clicked submit it told me that my database was read-only and so it couldn't write to it. Any ideas how to solve this one? Thanks :)

mehere
04-08-2005, 08:00 PM
Try this:

Right click on the database file, select Properties, and make sure it does not have the Read Only attribute checked.

integra
04-08-2005, 10:25 PM
I tried that and ReadOnly is unchecked. Don't know what else it could be? :confused:

mehere
04-08-2005, 10:50 PM
You may need to set the IUSR account to read/write permissions. Check out this and see if if helps:

http://www.aspfaq.com/show.asp?id=2205

integra
04-09-2005, 05:57 PM
Thanks, got it working. Problem was that I had to set it up for anyone to be able to write to. It was already set up for myself tho, so no idea why it didnt work like that...but anyway! Thanks for the help! :)