Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP Classic - SELECT query does not work

Status
Not open for further replies.

leifoet

Technical User
Jan 31, 2016
203
0
0
BE
SvAct should be for example : 10

<%
SvAct=(Application("UPDId"))
%>
(a response.wite test from SvAct also gives 10)

However, nothing is selected.
ActId should be also 10
Is the WHERE clause well-coded ?

<%
Dim Conn, rs, sql
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("_private/ABCD.mdb")
Set rs = Server.CreateObject("ADODB.Recordset")
sql = "SELECT * FROM ACTIVITY18 WHERE ActId=" & SVact
rs.Open sql, Conn
%>
Thanks.
 
Hi,

Is ActId field Numeric or Text? It could be...
Code:
sql = "SELECT * FROM ACTIVITY18 WHERE ActId=‘" & SVact &”’”

Are you sure that SVact contains 10?

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
It looks like Skip's code contains the alternative quotes which will cause issues if you copy and paste. If ActID is test, try:
Code:
sql = "SELECT * FROM ACTIVITY18 WHERE ActId='" & SVact &"'"

Did you open your database and try create a query with this SQL:

Code:
SELECT * FROM ACTIVITY18 WHERE ActId=10


Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
It’s my iPad.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
ActId field => Numeric

I get this error

Microsoft VBScript compilation error '800a0408'
Invalid character

sql = "SELECT * FROM ACTIVITY18 WHERE ActId=‘" & SVact &”’”
----------------------------------------------------------^

 
For clarity, on my screen, the error arrow points to this ”’” (at the end)
Thanks for help.
 
What results from...
Code:
SELECT Distinct ActId FROM ACTIVITY18 Where ActId <= 10
Do you get a 10 in that result?

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
I receive this error

Microsoft VBScript compilation error '800a0409'
Unterminated string constant
sql = "SELECT Distinct ActId FROM ACTIVITY18 WHERE ActId<=10

Thanks for solution
 
Code:
sql = "SELECT Distinct ActId FROM ACTIVITY18 WHERE ActId<=10[highlight #FCAF3E]”[/highlight]


Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
leifoet,
Always count your symbols that should be in pairs like single & double quotes, parentheses, and other bracketing. There should be an even number or a matching symbol.


Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top