p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_codeclinic thread: including a variable in SQL code in ASP


Message #1 by "Sinclair Armour" <supersinc@h...> on Fri, 20 Apr 2001 10:00:06
> " WHERE period_month = '" & iPmth & "' "
>
> if the database field is a string, or
>
> " WHERE period_month = " & iPmth & " "
>
> if the database field is an integer

	I made assumptions that you were using SQL Server and a datetime or
smalldatetime field.  If that is the case, the SQL statement I provided is
not correct.  If you are using MS Access, you can surround date data in #'s
and VBScript/Access generally is pretty good about converting it.  You still
might require a BETWEEN however.

? Chuck

> -----Original Message-----
> From: Alex Shiell, ITS, EC, SE [mailto:alex.shiell@s...]
> Sent: Friday, April 20, 2001 5:43 AM
> To: Code Clinic
> Subject: [proasp_codeclinic] RE: including a variable in SQL code in ASP
>
>
> " WHERE period_month = '" & iPmth & "' "
>
> if the database field is a string, or
>
> " WHERE period_month = " & iPmth & " "
>
> if the database field is an integer
>
> -----Original Message-----
> From: Sinclair Armour [mailto:supersinc@h...]
> Sent: Friday, April 20, 2001 11:00 AM
> To: Code Clinic
> Subject: [proasp_codeclinic] including a variable in SQL code in ASP
>
>
> I need to include a variable iPmth (ie the "month" from an input
> form) into
> a generated SQL statement.  Firstly - can I do it? Secondly if so what's
> the syntax.... eg " WHERE period_month = 'iPmth' " & _
> _______________________________________________________________________
> Scottish Enterprise Network
> http://www.scottish-enterprise.com
>

  Return to Index