where clause in asp
I have to create a website in asp for an college assignment, however im having trouble writing a where clause.
The query below works
<%
Dim ORp
Set oRSp=server.createobject("ADODB.recordset")
sqltext="Select * from products"
orsp.open sqltext, "dsn=20509703"
%>
But when i add the where clause i get errors
<%
Dim ORp
Set oRSp=server.createobject("ADODB.recordset")
sqltext="Select * from products where cat_ID='1' "
orsp.open sqltext, "dsn=20509703"
%>
the error for this query is like this
Provider error '80004005'
Unspecified error
/20509703/test.asp, line 13
benf posted this at 17:47 — 2nd January 2007.
They have: 426 posts
Joined: Feb 2005
fixed it i enclosed the integer in single quotes cat_ID='1' where it should not be in single quotes, im guessing because it is an integer?
JeevesBond posted this at 06:45 — 3rd January 2007.
He has: 3,956 posts
Joined: Jun 2002
Yes that's correct. Am sure I've made the same mistake with ASP before too.
Just love the error reporting: 'Unspecified error', how helpful!
a Padded Cell our articles site!
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.