ASP TO EMAIL AND DATABASE ERROR
I am trying to post data to a database and email it at the same time from a web page form. I get an error when I try to do this. Help!
Here is the form page:
Here is the action page:
<%@ Language=VBScript %>
<%
dim connectstr
connectstr="Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=emails;Data Source=VCSESUPPLYCHAIN"
dim conn
set conn=server.createobject("adodb.connection")
with conn
.open connectstr
.execute "INSERT INTO emailtrack(To,From,Subject,Body) Values('" & request("rcptaddr") & "','" & request("sndraddr") & "','" & request("subject") & "','" & request("body") & "')"
.close
end with
set conn=nothing
dim objsendmail
set objsendmail=server.CreateObject("cdonts.newmail")
objsendmail.To="ryan_gardner@non.hp.com"
objsendmail.From="ryan_gardner@non.hp.com"
objsendmail.Subject="This is a test"
objsendmail.Body="This is the body of the test"
objsendmail.Send
%>
Here is the error I get:
Microsoft OLE DB Provider for SQL Server error '80040e14'
Incorrect syntax near the keyword 'To'.
/buypower/apptest/esender.asp, line 11
What can I do to fix this?!?