Click to See Complete Forum and Search --> : sql select with where clause


anonymous
08-27-2002, 05:27 AM
[Originally posted by jack]

Ok I have now tried to use an sql statement, like this

<!--#include file="Email_datalink.asp"-->
Dim objrs
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open objConn˙ ˙ ˙ ˙ ˙ 'from include file at top of page
strSQL = "SELECT * FROM qrycc_main " _
˙ ˙ ˙  & "WHERE Resort LIKE '" & Request.Form("dropresort") & "'"
Set oRs = oConn.Execute(strSQL)


How do I pass another field into the where clause form the request page??

any help very much appreciated
Cheers Jack

anonymous
08-27-2002, 07:13 AM
[Originally posted by JAG]

use an AND

SELECT * FROM table WHERE columA='x' and columB ='y'

grtz
<b>JAG</b>

anonymous
08-27-2002, 07:28 AM
[Originally posted by jack]

But I need to pass the values as two variables from one request page with two drop down boxes which act as user choices, so I cant just write the values in!!
Jack

anonymous
08-27-2002, 06:36 PM
[Originally posted by gonzalo]

did you tryed to use 2 different sql commands?
one for each drop down boxes?

anonymous
08-27-2002, 07:18 PM
[Originally posted by k2]

how to select latest data from database ???

anonymous
09-14-2002, 08:36 PM
[Originally posted by Bernie Lawrence]

You can have as many fields passed and used in the sql statement as you want.˙ For instance, if you also wanted to make sure the Location was equal to something and you passed it the input from your form as location then you could add it to the SQL statement as follows.

strSQL = "SELECT * FROM qrycc_main " _
˙ ˙ ˙ & "WHERE Resort LIKE '" & Request.Form("dropresort") & "' AND Location LIKE '" & Request.Form("location") & "'"