Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to insert variables into my table

Status
Not open for further replies.

inteleserve

IS-IT--Management
Dec 13, 2002
75
US
strSQL = "insert into usertable values ('fullname', 'address', 'city', 'state', 'zip', 'zip4', 'phone')"


**above is the sql string i am using. This string writes 'fullname' 'address' etc inside my table. I need it to write "BOB SMITH", "208 Jake Street" etc inside my table from a form.

I have tried the string below.....

strSQL = "insert into usertable values ('"& fullname &'", '"& address &"', '"& city &"', '"& state &"', '"& zip &"', '"& zip4 &"', '"& phone &'")"


...... however this method does not write anything and just inserts a blank line into my table.

Any ideas on what needs to be done here? Or does someone have a sample script from an online form that i can take a look at?

Thanks,

Ross Lund
 
How are you populating the variables? From a form?

Have you assigned the data to the variables?

ie: FullName = request("FullName")

Could try this:(all on one line)
strSQL = "insert into usertable values ('"& request("fullname") &'", '"& request("address") &"', '"& request("city") &"', '"& request("state") &"', '"& request("zip")
&"', '"& request("zip4") &"', '"& request("phone") &'")"

Note: I highly suggest that you validate all the data passed by the form to ensure that no one is gonna mess with your DB...

Bastien
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top