|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
IF THEN condition in SQL
<i><b>Originally posted by : Edward Qiu (e.qiu@neworldnet.com)</b></i><br />How to rewrite the following code in asp:<br /><br />SQLString = "SELECT * from CFA_Art WHERE 1=1" &_<br /> If Request.Form("artist_number") <> "" then<br /> "and ArtistID ='" & Request.Form("artist_number") & "'" &_<br /> end if<br /> If Request.Form("style_number") <> "" then<br /> "and StyleID ='" & Request.Form("style_number") & "'" &_<br /> end if<br /> <br /> If Request.Form("subject_number") <> "" then<br /> "and SubjectID ='" & Request.Form("subject_number") & "'" &_<br /> end if<br /> If Request.Form("theme_number") <> "" then<br /> "and ThemeID ='" & Request.Form("theme_number") & "'" <br /> end if<br /> <br /> <br /> ArtRS.Open SQLString, Conn, 1,2<br /><br /><br />Many thanks!<br />
|
|
#2
|
|||
|
|||
|
<i><b>Originally posted by : steve</b></i><br />http://www.aspalliance.com/glenncook/searchcode.asp<br /><br />there is a link to a search engine example<br /><br /><br />------------<br />Edward Qiu at 3/9/2000 3:06:02 PM<br /><br />How to rewrite the following code in asp:<br /><br />SQLString = "SELECT * from CFA_Art WHERE 1=1" &_<br /> If Request.Form("artist_number") <> "" then<br /> "and ArtistID ='" & Request.Form("artist_number") & "'" &_<br /> end if<br /> If Request.Form("style_number") <> "" then<br /> "and StyleID ='" & Request.Form("style_number") & "'" &_<br /> end if<br /> <br /> If Request.Form("subject_number") <> "" then<br /> "and SubjectID ='" & Request.Form("subject_number") & "'" &_<br /> end if<br /> If Request.Form("theme_number") <> "" then<br /> "and ThemeID ='" & Request.Form("theme_number") & "'" <br /> end if<br /> <br /> <br /> ArtRS.Open SQLString, Conn, 1,2<br /><br /><br />Many thanks!<br />
|
![]() |
| Viewing: ASP Free Forums > Programming > ASP Development > IF THEN condition in SQL |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|