|
-
Jan 30th, 2002, 12:38 PM
#1
Thread Starter
Fanatic Member
*** RESOLVED *** ASP >> SQL SELECT * and WHERE ? How does it work?
Hi,
I extend now my question.
I am currently creating a ASP-FIle in which I want to use only selected data. This data I want to get with:
numID_Region = 2
numID_Area = 4
I got already the answer if I use WHERE with one option, How i can use WHERE with two options?
With one option I got this answer here and it works fine (Thanks):
Set rstProvince = CreateObject("ADODB.Recordset")
rstProvince.Open "SELECT * FROM Guide WHERE ID_Region = " & numID_Region & " ORDER BY ID_Region, ID_Province", con
So, now the question, how can I include the second Restriction?
Thanks in advance for your help
Franky
I found the solution, thanks!
Last edited by Franky; Feb 4th, 2002 at 02:03 PM.
-
Jan 30th, 2002, 12:45 PM
#2
Black Cat
ASP doesn't know your SQL string from any other string, and VBScript doesn't offer cool variable interpolation like Perl, so:
Code:
rstProvince.Open "SELECT * FROM Guide WHERE ID_Region = " & numID_Region & " ORDER BY ID_Region, ID_Province", con
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Jan 31st, 2002, 02:19 AM
#3
Thread Starter
Fanatic Member
-
Feb 1st, 2002, 12:46 PM
#4
Thread Starter
Fanatic Member
Only to bring the question back to page 1
-
Feb 1st, 2002, 01:23 PM
#5
Black Cat
VB Code:
rstProvince.Open "SELECT * FROM Guide WHERE ID_Region = " & numID_Region & " AND ID_Area = " & numID_Area & " ORDER BY ID_Region, ID_Province", con
You're simply creating an SQL string dynamically.
Last edited by JoshT; Feb 4th, 2002 at 11:50 AM.
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Feb 1st, 2002, 04:57 PM
#6
Thread Starter
Fanatic Member
Hi JoshT
I did exactly what you showed me here.
Maybe it was a writing error from my side. I will check it again.
Thanks
-
Feb 2nd, 2002, 02:18 AM
#7
PowerPoster
hi
Use:
Code:
select * from TableName where Fieldname1 = '" & myvar & "' and FieldName2 = '" & myvar2 & "'"
Hope this helps.
-
Feb 4th, 2002, 11:52 AM
#8
Black Cat
Re: Hi JoshT
Originally posted by Franky
I did exactly what you showed me here.
Maybe it was a writing error from my side. I will check it again.
Thanks
I edited out a small typo - let us know if you get specific error messages.
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|