Active Server Pages Programming (ASP)/sql error

Advertisement


Question
dear sir,

how to add in 'where' clause after this sql statement?
sql="select  *  from pay" & month(now)

i tried this but fail, please help, thanks...
sql="select  *  from pay '" & month(now) & "' where empid='" & session("userid") & "'"


Answer
Hi Callisto,

If you have seperate object called pay8, pay9, pay10 for respective 8th, 9th, 10th months in your database and

EmpID field being integer. Your query goes like this:

sql="select * from pay" & month(now) & " where empid=" & session("userid") & ""

EmpID field being char/varchar. Your query goes like this:

sql="select * from pay" & month(now) & " where empid='" & session("userid") & "'"

Regards

Active Server Pages Programming (ASP)

All Answers


Answers by Expert:


Ask Experts

Volunteer


Ujjwal

Expertise

Six ASP Objects, ASP and Database Coding, Stored Procedure, EMail, Printing in ASP, VBScript, WebServer(IIS) Configuration, Active X Programming, Session Variable, Application Variables, Cookies, Global.ASA

Experience

ASP, COM, SQL SERVER 2000, .NET, SMS, MOM, Crstal Reports, MsProject, BizTalk Serve, Sharepoint Portal Server, Oracle D2K

©2012 About.com, a part of The New York Times Company. All rights reserved.