Forum Moderators: phranque
sql="INSERT INTO [visitors] ([cmpname], [address], [city], [state], [zip], [number], [contact], [email], [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("pwrd") & "',"
sql=sql & "'" & Request.Form("username") & "')"
objConn.Execute(sql)
Has this select EVER worked? By what I can see - I doubt it.
If not, what's with the brackets?
sql="INSERT INTO [visitors] ([cmpname], [address], [city], [state], [zip], [number], [contact], [email], [pwrd], [username])"
a normal select statement should just be the field names:
sql="INSERT INTO visitors (cmpname, address, city, state, zip, number, contact, email, pwrd, username) values (...);"
Another thing you should do immediately - CHANGE YOUR PASSWORD - you just gave a hacker everything they need to know to get into your database by posting your connection string and you should change your SQL password right away. In the future, don't post the connection string as you did since its not necessary for troubleshooting syntax errors, only connection errors.
Code is:
Dim Mail
Set Mail=Server.CreateObject("CDONTS.NewMail")
Mail.to="#*$!xxxxxxxxxx@xxxx.xxx"
Mail.From="lxxxxxxxxxxxxxx@xx.xxx"
Mail.Subject="Visitor Registration"
Mail.MailFormat= 0
Mail.BodyFormat=0
Mail.Body="<h2>Hey Sean, someone just registered with your site. Check it out!</h2>"
Mail.Send
Set Mail=nothing
if err<>0 then
Response.Write(Err.Description)
else
response.redirect("login.asp")
end if
connection.close