View Single Post
Old 02-03-2011, 06:00 PM   #4
Ciombe
 
Join Date: Feb 2011
Posts: 4
Default

Works!!!!

this is the good code

HTML Code:
<%
Dim rsTrova__MMColParam
rsTrova__MMColParam = "prova"
If (Request.Form("txt_field") <> "") Then 
  rsTrova__MMColParam = Request.Form("txt_field")
End If
%>
<%
Dim rsTrova__MMColParam1
rsTrova__MMColParam1 = "5"
If (Request.Form("select_name")  <> "") Then 
  rsTrova__MMColParam1 = Request.Form("select_name") 
End If
%>
<%
Dim rsTrova
Dim rsTrova_cmd
Dim rsTrova_numRows

Set rsTrova_cmd = Server.CreateObject ("ADODB.Command")
rsTrova_cmd.ActiveConnection = MM_dbMyDB_STRING
rsTrova_cmd.CommandText = "SELECT * FROM MyTable WHERE my_field LIKE '%' + ? + '%' AND my_field2 = ? ORDER BY field3 DESC" 
rsTrova_cmd.Prepared = true
rsTrova_cmd.Parameters.Append rsTrova_cmd.CreateParameter("param1", 200, 1, 255, rsTrova__MMColParam) ' adVarChar
rsTrova_cmd.Parameters.Append rsTrova_cmd.CreateParameter("param2", 5, 1, -1, rsTrova__MMColParam1) ' adDouble

Set rsTrova = rsTrova_cmd.Execute
rsTrova_numRows = 0
%>
Ciombe is offline   Reply With Quote