G
Guest
hi,
i am trying to write records from an ASPX page to a access database, but get
an error on my insert statement, but not on a select statement. please let me
know if you can see what i'm doing wrong, code is below:
strFirstName = Request.Form("FirstName")
strLastName = Request.Form("LastName")
strCompanyName = Request.Form("CompanyName")
strTelephone = Request.Form("Telephone")
strFAX = Request.Form("FAX")
strStreetAddress = Request.Form("StreetAddress")
strCity = Request.Form("City")
strStateProvince = Request.Form("StateProvince")
strZipPostalCode = Request.Form("ZipPostalCode")
strUsername = Request.Form("Username")
strPassword = Request.Form("Password")
curDir = Server.MapPath("\registrationdb.mdb")
set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" &
"C:\RegistrationDB.mdb" & ";"
Set oRs = Server.CreateObject("ADODB.Recordset")
Set oRs.ActiveConnection = oConn
oRs.Source = "INSERT INTO tblCustomerInfo (FirstName, LastName,
CompanyName, Telephone, FAX, StreetAddress, City, StateProvince,
ZipPostalCode, Username, Password) VALUES ('" & strFirstName & "', '" &
strLastName & "', '" & strCompanyName & "', '" & strTelephone & "', '" &
strFAX & "', '" & strStreetAddress & "', '" & strCity & "', '" &
strStateProvince & "', '" & strZipPostalCode & "', '" & strUsername & "', '"
& strPassword & "')"
oRs.Open
i am trying to write records from an ASPX page to a access database, but get
an error on my insert statement, but not on a select statement. please let me
know if you can see what i'm doing wrong, code is below:
strFirstName = Request.Form("FirstName")
strLastName = Request.Form("LastName")
strCompanyName = Request.Form("CompanyName")
strTelephone = Request.Form("Telephone")
strFAX = Request.Form("FAX")
strStreetAddress = Request.Form("StreetAddress")
strCity = Request.Form("City")
strStateProvince = Request.Form("StateProvince")
strZipPostalCode = Request.Form("ZipPostalCode")
strUsername = Request.Form("Username")
strPassword = Request.Form("Password")
curDir = Server.MapPath("\registrationdb.mdb")
set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" &
"C:\RegistrationDB.mdb" & ";"
Set oRs = Server.CreateObject("ADODB.Recordset")
Set oRs.ActiveConnection = oConn
oRs.Source = "INSERT INTO tblCustomerInfo (FirstName, LastName,
CompanyName, Telephone, FAX, StreetAddress, City, StateProvince,
ZipPostalCode, Username, Password) VALUES ('" & strFirstName & "', '" &
strLastName & "', '" & strCompanyName & "', '" & strTelephone & "', '" &
strFAX & "', '" & strStreetAddress & "', '" & strCity & "', '" &
strStateProvince & "', '" & strZipPostalCode & "', '" & strUsername & "', '"
& strPassword & "')"
oRs.Open