MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old March 27th, 2004, 07:51 PM
accountant1040 accountant1040 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 1 accountant1040 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Red face Trouble inserting form results into a mysql Database table using asp & vbscript

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?

Reply With Quote
  #2  
Old March 28th, 2004, 02:01 AM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 8 m 57 sec
Reputation Power: 9
Send a message via ICQ to stumpy Send a message via MSN to stumpy
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.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > Trouble inserting form results into a mysql Database table using asp & vbscript


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway