Forum Moderators: open

Message Too Old, No Replies

update a database?

         

Blelisa

7:55 pm on Dec 4, 2006 (gmt 0)

10+ Year Member



HI I am using asp to write to a database for users to register with me through a form on my web. It is not working.

the error I get is:
Microsoft JET Database Engine error '80004005'

Operation must use an updateable query.

/hemisphe/prolg.asp, line 32

My asp page writing it has code of:

<%
Dim intCounter, intDecimal, strPassword

For intCounter = 1 To 6
Randomize
intDecimal = Int((26 * Rnd) + 1) + 64

strPassword = strPassword & Chr(intDecimal)

Next

set connection=Server.CreateObject("ADODB.Connection")
connection.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &_
server.MapPath("data/hemicustreg.mdb")
connection.Open

sql="INSERT INTO [customer] ([cmpname], [address], [city], [state], [zip], [number], [contact], [email], [system], [pwrd], [username])"
sql=sql & "VALUES"
sql=sql & "('" & Request.Form("cmpname") & "',"
sql=sql & "'" & Request.Form("address") & "',"
sql=sql & "'" & Request.Form("city") & "',"
sql=sql & "'" & Request.Form("state") & "',"
sql=sql & "'" & Request.Form("zip") & "',"
sql=sql & "'" & Request.Form("number") & "',"
sql=sql & "'" & Request.Form("contact") & "',"
sql=sql & "'" & Request.Form("email") & "',"
sql=sql & "'" & Request.Form("system") & "',"
sql=sql & "'" & strpassword & "',"
sql=sql & "'" & Request.Form("username") & "')"

connection.Execute(sql)

Dim Mail
Set Mail=Server.CreateObject("CDONTS.NewMail")

HTML = HTML & "<HTML>"
HTML = HTML & "<HEAD>"
HTML = HTML & "<TITLE>Send Mail with HTML</TITLE>"
HTML = HTML & "</HEAD>"
HTML = HTML & "<BODY>"
HTML = HTML & "<TABLE cellpadding=""4"">"
HTML = HTML & "<TR><TH><FONT color=""red"">"
HTML = HTML & "<IMG SRC=""myImage.gif""></A><BR><BR>"
HTML = HTML & "<h2>Thank you for Registering with Example Communications</h2></TH></TR>"
HTML = HTML & "<TR><TH><FONT color=""blue"" SIZE=""4"">"
HTML = HTML & "Your password is&nbsp;" & strPassword
HTML = HTML & "<BR><BR>"
HTML = HTML & "To Log In <a href=""http://www.example.net/login.html"">Click Here</a>&nbsp;or go to http://www.example.net/login.html</TH></TR>"
HTML = HTML & "</FONT></TD></TR></TABLE><BR><BR>"
HTML = HTML & "</BODY>"
HTML = HTML & "</HTML>"

Mail.to=Request.Form("email")
Mail.From="lblendowski@example.net"
Mail.Subject="example.net Registration"
Mail.MailFormat= 0
Mail.BodyFormat=0
Mail.Body=HTML
Mail.Send
Set Mail=nothing

if err<>0 then
Response.Write(Err.Description)
else
response.redirect("tyreg.html")
end if
connection.close

%>

Can someone please point out what I am doing wrong? Should the code be UPDATE instead of INSERT?

Any help is greatly appreciated!

[edited by: encyclo at 8:40 pm (utc) on Dec. 4, 2006]
[edit reason] examplified [/edit]

FalseDawn

10:10 pm on Dec 4, 2006 (gmt 0)

10+ Year Member



Have you ruled out the possible problems listed here?
[support.microsoft.com...]

aspdaddy

10:41 pm on Dec 5, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Write out the sql to the screen just before the execute, then copy and paste it into access and run it to see if it has any errors.

My guess is the missing space before the word VALUES.