|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Help with search Query
I am somewhat new to SQL Query Language and have a Question that some one may be able to help me with. I am trying to search a recordset using two variables. I am pulling them from a search form. This is the query that I am trying to use but does not seem to be right.
"SELECT * FROM Run WHERE Code ='" + Replace(codetype, "'", "''") + "' AND Color = '" + Replace(colortype, "'", "''") + "'" What am I doing wrong? Thanks in advance Merlin |
|
#2
|
||||
|
||||
|
What are the data types of code and color in the database?
assuming they are both text or varchar, then you should be able to do something like this Code:
codetype = Request.Form("codeType")
colortype = Request.Form("colorType")
"SELECT * FROM [Run] WHERE [Code] = '" & ReplaceQuotes(codetype) & "' AND [Color] '" & ReplaceQuotes(colortype) & "'"
Function ReplaceQuotes(value)
value = Replace(value, "'", "''")
ReplaceQuotes = value
End Function
VBScripts concatenation operator is the & sign, not the + sign. |
|
#3
|
|||
|
|||
|
Thank you its working
Thank you! I have it working now.
Merlin |
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > Help with search Query |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|