|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
Does anyone know what I am doing wrong. I'm trying to insert the result of a form into a table in a database with variables. I know vbscript pretty well and I've been able to do this with an access database in the past but with mysql it is not working. Here is my code: <% dim objConn dim objRS, strQuery dim sUsername, sFname, sLname, sPassword, sSex, sYearsinthetruth, sBday, sEmail dim sCity, sState, sZip, sCountry, sCongname, sMarital, sSecretq, sSecreta sUsername = Request.Form("username") sFname = Request.Form("fname") sLname = Request.Form("lname") sPassword = Request.Form("password") sSex = Request.Form("sex") sYearsinthetruth = Request.Form("Years") sBday = Request.Form("bday") sEmail = Request.Form("email1") sCity = Request.Form("city") sState = Request.Form("state") sZip = Request.Form("zip") sCountry = Request.Form("country1") sCongname = Request.Form("congname") sMarital = Request.Form("marital") sSecretq = Request.Form("secretq") sSecreta = Request.Form("secreta") set objConn = Server.CreateObject("ADODB.Connection") objConn.Open "Driver={MySQL ODBC 3.51 Driver}; Server=www.travelinthetruth.com; Port=3306; Option=0; Socket=; Stmt=; Database=travelinthetruth_com; Uid=a00014b9; Pwd=frog;" Set objRS = Server.CreateObject ("ADODB.Recordset") objRS.Open "Users", objConn strQuery = "INSERT INTO Users VALUES(sUsername, sFname, sLname, sPassword, sSex, sYearsinthetruth, sBday, sEmail, sCity, sState, sZip, sCountry, sCongName, sMarital, sSecretq, sSecreta)" objConn.Execute strQuery Set objRS = Nothing objConn.Close Set objRS = nothing Set objConn = nothing //Response.Redirect "membershome.asp?STATUS=Joined&FNAME=" & sFname & "&UNAME=" & sUsername & "&LNAME=" & sLname %> and the error I'm getting on Submit is: ADODB.Connection.1error '80004005' SQLState: 42S22 Native Error Code: 1054 [TCX][MyODBC]Unknown column 'sUsername' in 'field list' /welcome.asp, line 35 Anybody have any answers for me? |
|
#2
|
||||
|
||||
|
An INSERT statement looks like this:
INSERT INTO tablename (fieldname list, etc, etc) VALUES (value list, etc, etc) So, you need to make sure you have your fieldname list nin front of the VALUES keyword. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > Trouble inserting form results into a mysql Database table using asp & vbscript |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|