RE: ASP Insert into Access DB

by "Brett Errington" <brett(at)opensearch.com>

 Date:  Sun, 10 Aug 2003 13:17:35 +0800
 To:  <hwg-techniques(at)hwg.org>
 In-Reply-To:  kenscomputer
  todo: View Thread, Original
Just out of curiosity...

Are you actually assigning those variables to what's in the posted form
first? I just want to make sure you aren't missing the
Request.Form("variableName") part before I try and work out something else.

It seems like that might be a step you're missing.

- Brett

-----Original Message-----
From: owner-hwg-techniques(at)hwg.org [mailto:owner-hwg-techniques(at)hwg.org] On
Behalf Of Ken Richardson
Sent: Sunday, 10 August 2003 2:46 AM
To: hwg-techniques(at)hwg.org
Subject: ASP Insert into Access DB

Hi All:
I have a problem that has me stumped.  I have an Access database and a
page with a form.  I fill in the form and submit it to a page
(confirm.asp) that does the actual insert. This is where the connection
and sql etc are.  I have tried with both post and get on the form.  In
the header I can see
confirm.asp?ClosingSales=Closing+Sales&other=&attendNumber= etc.

When I get to confirm.asp the record is inserted into the database.
Problem is that the first 6 fields are check boxes and are assigned a
value, if the value is "" then set it to "0".  So that a checked box
will have a value and not "". What gets inserted into the database is
always "0", as well all text box fields are blank. 
I have a response.write for the sql and this is what it outputs to the
page
Insert Into
Questionnaire(closingSales,multipleSelling,fragranceKnow,dealingWith,mer
chandising,onCounter,Other,attend,AttendNumber,firstName,lastName,compan
y,title,address1,address2,city,province,postalCode,email,phone)
Values('0','0','0','0','0','0','','','','','','','','','','','','','',''
);

My SQL statement is this:
sSQL = "Insert Into
Questionnaire(closingSales,multipleSelling,fragranceKnow,dealingWith,mer
chandising," _
&
"onCounter,Other,attend,AttendNumber,firstName,lastName,company,title,ad
dress1,address2,city,province,postalCode,email,phone)
Values('"&ClosingSales&"','"&MultipleSelling&"','"&FragranceKnowledge&"'
,'"&Dealingwith&"','"&Merchandising&"','"&OnCounter&"','"&other&"','"&At
tend&"','"&attendNumber&"','"&FirstName&"','"&LastName&"','"&Company&"',
'"&Title&"','"&Address1&"','"&Address2&"','"&City&"','"&Province&"','"&P
ostalCode&"','"&Email&"','"&Phone&"');"

The values from the form are not getting to the confirm.asp page or are
not getting to the sql.
This is running on an Access 2000 db on an NT server.  I do need to be
able to go to the second page to thank users for filling out the form. 

All suggestions gratefully accepted. Thanks in advance.

Take care.

Ken

NOTE: All email is virus scanned.

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA