Dave wrote:
> I have an old web app that ues an Access database and ASP 3.0.
>
> I need to build an INSERT statement based on the contents of a form.
>
> What is the best way to handle blank text boxes that are submitted
> with the form?
>
> For example, I collect all my name/value pairs that are submitted
> with the form like this...
>
> sExample=Request.Form("txaExample")
> sNote=Request.Form("txtNote")
> iSourceID=Request.Form("cboSourceID")
> iPageNo=Request.Form("txtPageNo")
> sSourceRef=Request.Form("txtSourceRef")
>
>
> ...and then I build my INSERT statement like this...
>
> sSQL = "INSERT INTO example (example, sourceid, sourceref, pageno,
> note)" sSQL = sSQL & " VALUES ('" & sExample & "', "
> sSQL = sSQL & cstr(iSourceID) & ", "
> sSQL = sSQL & "'" & sSourceRef & "', "
> sSQL = sSQL & cstr(iPageNo) & ", "
> sSQL = sSQL & "'" & sNote & "' "
> sSQL = sSQL & ")"
>
Further points to consider:
Your use of dynamic sql is leaving you vulnerable to hackers using sql
injection:
http://mvp.unixwiz.net/techtips/sql-injection.html
http://www.sqlsecurity.com/DesktopDefault.aspx?tabid=23
See here for a better, more secure way to execute your queries by using
parameter markers:
http://groups-beta.google.com/group/...e36562fee7804e
Personally, I prefer using stored procedures, or saved parameter queries
as
they are known in Access:
Access:
http://www.google.com/groups?hl=en&l...TNGP12.phx.gbl
http://groups.google.com/groups?hl=e...tngp13.phx.gbl
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"