Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Trouble with update vs insert code
Old 12-04-2006, 03:56 PM Trouble with update vs insert code
blelisa's Avatar
Experienced Talker

Posts: 45
Location: Western New York
Trades: 0
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:
Code:
<%
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 Hemisphere 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.hemisphere.net/login.html"">Click Here</a>&nbsp;or go to http://www.hemisphere.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@hemisphere.net"
Mail.Subject="Hemisphere.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!
blelisa is offline
Reply With Quote
View Public Profile Visit blelisa's homepage!
 
 
Register now for full access!
Old 12-05-2006, 02:56 AM Re: Trouble with update vs insert code
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
Nope. Your code should work in this instance. (Although it will need to be cleaned up at some point, but first things first.)

What you're experiencing is a common thing...a misconfigured host. Your host doesn't have write permissions set on the folder containing your database. This means that the files in that folder cannot be altered in any way, including in this case the inserting of data.

Bit of a pain in the butt when working on a database-driven site, isn't it?

The good news is that it's fixable. If your host has any semblance of a clue, they should know what to do.

If not, point them to this article and this should help them:

http://support.microsoft.com/kb/175168
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 12-06-2006, 04:29 AM Re: Trouble with update vs insert code
Average Talker

Posts: 22
Name: Momo
Trades: 0
put a space before "values" keyword in sql query.
check that all fields name are currect and db file has write/update permission by iuser
ophir.oren is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Trouble with update vs insert code
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11735 seconds with 12 queries