I am trying to insert a new record into a database containing data captured from a form. I am repeatedly getting an error, and can't seem to resolve it. Please help! Thanks for your time...
Dim oConn, sSQL
Dim connectstr, sDSNDir
Dim dsn_name, fieldname, tablename
Dim firstname, lastname, company, telephone, email, currentprovider, callspeople, callslength, cardtype, cardnumber, cardexpiration, cardsecnumber, cardfullname, cardzip, address1, address2, city, sstate, zip, recommend
firstname = Request.Form("firstname")
lastname = Request.Form("lastname")
company = Request.Form("company")
telephone = Request.Form("telephone")
email = Request.Form("email")
currentprovider = Request.Form("conference")
callspeople = Request.Form("callspeople")
callslength = Request.Form("callslength")
cardtype = Request.Form("cardtype")
cardnumber = Request.Form("cardnumber")
cardexpiration = Request.Form("cardexpiration")
cardsecnumber = Request.Form("security")
cardfullname = Request.Form("cardfullname")
cardzip = Request.Form("cardzip")
address1 = Request.Form("address1")
address2 = Request.Form("address2")
city = Request.Form("city")
sstate = Request.Form("state")
zip = Request.Form("zipcode")
recommend = Request.Form("recommend")
sSQL = "INSERT into UserData (firstname, lastname, company, telephone, email, currentprovider, callspeople, callslength, cardtype, cardnumber, cardexpiration, cardsecnumber, cardfullname, cardzip, address1, address2, city, sstate, zip, recommend) values ('" & _
firstname & "', '" & lastname & "', '" & company & "', '" & telephone & "', '" & email & "', '" & currentprovider & "', '" & callspeople & "', '" & callslength & "', '" & cardtype & "', '" & cardnumber & "', '" & cardexpiration & "', '" & cardsecnumber & "', '" & cardfullname & "', '" & cardzip & "', '" & address1 & "', '" & address2 & "', '" & city & "', '" & sstate & "', '" & zip & "', '" & recommend & "')"
dsn_name = "access_data.dsn"
fieldname = "firstname"
tablename = "UserData"
sDSNDir = Server.MapPath("_dsn")
connectstr = "filedsn=" & sDSNDir & "\" & dsn_name
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open connectstr
oConn.execute(sSQL)
oConn.Close
Set oConn = Nothing