Ask a Question related to ASP Database, Design and Development.
-
targa #1
Session variable in SELECT statement?
What am I doing wrong here?
This works:
SELECT Count(ID) AS MyCount FROM mytable WHERE Status = '1'
But when I try to add a session value in the query I get invalid syntax
SELECT Count(ID) AS MyCount FROM mytable WHERE Status = '1' AND StatID = "
& session("Dealer_ID") & ""
Ive tried tons of variables but cant seem to get it right.
TIA!
targa Guest
-
SP with Select statement
Hi, I'm trying to select fileds that are in the results of a SP. So I have the table "tblItem" itemID int Identity Key, itemName varchar... -
variable select statement
I would like to have a form that gives the user choices for selection parameters for email, printing etc. A real simple example: Give me all... -
help with SELECT statement
"Aaron" <abroadway@ameritrust.com> wrote in message news:05a601c365df$b31a8d40$a401280a@phx.gbl... "SUM(ABS(action_date>= {" & start_date2 & "}... -
SQL select statement problem...
I'm not sure if this is possible or not, but this is what I would like to do is something like this: I have two tables. Table A has 4 rows (with... -
SELECT statement
I have 3 tables: table countryPrice: productID countryId price 1 Italy 90 1 England ... -
Ken Schaefer #2
Re: Session variable in SELECT statement?
a) What is the *exact* error?
b) Number 1 SQL troubleshooting tip:
<%
strSQL = _
"SELECT Count(ID) AS MyCount " & _
"FROM mytable " & _
"WHERE Status = '1' " & _
"AND StatID = " & session("Dealer_ID")
Response.Write(strSQL)
Response.End
%>
so you can see what you're actually sending to the database.
Cheers
Ken
"targa" <targa1@alltel.net> wrote in message
news:%23I0dkUafDHA.1736@TK2MSFTNGP12.phx.gbl...
: What am I doing wrong here?
:
: This works:
: SELECT Count(ID) AS MyCount FROM mytable WHERE Status = '1'
:
: But when I try to add a session value in the query I get invalid syntax
:
: SELECT Count(ID) AS MyCount FROM mytable WHERE Status = '1' AND StatID =
"
: & session("Dealer_ID") & ""
:
: Ive tried tons of variables but cant seem to get it right.
:
: TIA!
:
:
:
Ken Schaefer Guest
-
Bullschmidt #3
Re: Session variable in SELECT statement?
Perhaps change this:
SELECT Count(ID) AS MyCount FROM mytable WHERE Status = '1' AND StatID
= "
& session("Dealer_ID") & ""
To be more like this instead:
SELECT Count(ID) AS MyCount FROM mytable WHERE (Status = '1') AND
(StatID = '"
& session("Dealer_ID") & "')"
Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
[url]http://www.Bullschmidt.com[/url]
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Bullschmidt Guest



Reply With Quote

