|
lu lu -> RE: AND / OR paramaters (9/19/2002 17:25:07)
|
rdouglass i looked over you example that set me on this path and i noticed how the submit button was set up, so i implemented the same. But still no luck retrieving a query, what could be wrong? I also tried doing a search using " ID" and " province" and the dreaded error occured again: Too few parameters. Expected 1. <% ' FP_ASP ASP Automatically generated by a Frontpage Component. Do not Edit. On Error Resume Next strErrorUrl = " " If Request.ServerVariables(" REQUEST_METHOD" ) = " POST" Then If Request.Form(" VTI-GROUP" ) = " 0" Then Err.Clear Set fp_conn = Server.CreateObject(" ADODB.Connection" ) FP_DumpError strErrorUrl, " Cannot create connection" Set fp_rs = Server.CreateObject(" ADODB.Recordset" ) FP_DumpError strErrorUrl, " Cannot create record set" fp_conn.Open Application(" applicant_ConnectionString" ) FP_DumpError strErrorUrl, " Cannot open database" fp_rs.Open " Results2" , fp_conn, 1, 3, 2 ' adOpenKeySet, adLockOptimistic, adCmdTable FP_DumpError strErrorUrl, " Cannot open record set" fp_rs.AddNew FP_DumpError strErrorUrl, " Cannot add new record set to the database" Dim arFormFields0(18) Dim arFormDBFields0(18) Dim arFormValues0(18) arFormFields0(0) = " occupation" arFormDBFields0(0) = " occupation" arFormValues0(0) = Request(" occupation" ) arFormFields0(1) = " contact_person" arFormDBFields0(1) = " contact_person" arFormValues0(1) = Request(" contact_person" ) arFormFields0(2) = " address" arFormDBFields0(2) = " address1" arFormValues0(2) = Request(" address" ) arFormFields0(3) = " occupation_value" arFormDBFields0(3) = " occupation_value" arFormValues0(3) = Request(" occupation_value" ) arFormFields0(4) = " postal_code" arFormDBFields0(4) = " postal_code" arFormValues0(4) = Request(" postal_code" ) arFormFields0(5) = " number_of_employees" arFormDBFields0(5) = " number_of_employees" arFormValues0(5) = Request(" number_of_employees" ) arFormFields0(6) = " esi_representative" arFormDBFields0(6) = " esi_representative" arFormValues0(6) = Request(" esi_representative" ) arFormFields0(7) = " service_purchased" arFormDBFields0(7) = " service_purchased" arFormValues0(7) = Request(" service_purchased" ) arFormFields0(8) = " comments" arFormDBFields0(8) = " comments" arFormValues0(8) = Request(" comments" ) arFormFields0(9) = " record_input" arFormDBFields0(9) = " record_input" arFormValues0(9) = Request(" record_input" ) arFormFields0(10) = " fax_number" arFormDBFields0(10) = " fax_number" arFormValues0(10) = Request(" fax_number" ) arFormFields0(11) = " province" arFormDBFields0(11) = " province" arFormValues0(11) = Request(" province" ) arFormFields0(12) = " company_name" arFormDBFields0(12) = " company_name" arFormValues0(12) = Request(" company_name" ) arFormFields0(13) = " phone_number" arFormDBFields0(13) = " phone_number" arFormValues0(13) = Request(" phone_number" ) arFormFields0(14) = " line_of_business" arFormDBFields0(14) = " line_of_business" arFormValues0(14) = Request(" line_of_business" ) arFormFields0(15) = " city" arFormDBFields0(15) = " city" arFormValues0(15) = Request(" city" ) arFormFields0(16) = " occupation_name" arFormDBFields0(16) = " occupation_name" arFormValues0(16) = Request(" occupation_name" ) arFormFields0(17) = " sales_volume" arFormDBFields0(17) = " sales_volume" arFormValues0(17) = Request(" sales_volume" ) FP_SaveFormFields fp_rs, arFormFields0, arFormDBFields0 If Request.ServerVariables(" HTTP_USER_AGENT" ) <> " " Then FP_SaveFieldToDB fp_rs, Request.ServerVariables(" HTTP_USER_AGENT" ), " Browser_type" End If If Request.ServerVariables(" REMOTE_HOST" ) <> " " Then FP_SaveFieldToDB fp_rs, Request.ServerVariables(" REMOTE_HOST" ), " Remote_computer_name" End If FP_SaveFieldToDB fp_rs, Now, " Timestamp" If Request.ServerVariables(" REMOTE_USER" ) <> " " Then FP_SaveFieldToDB fp_rs, Request.ServerVariables(" REMOTE_USER" ), " User_name" End If fp_rs.Update FP_DumpError strErrorUrl, " Cannot update the database" fp_rs.Close fp_conn.Close FP_FormConfirmation " text/html; charset=windows-1252" ,_ " Form Confirmation" ,_ " Thank you for submitting the following information:" ,_ " admin_e.asp" ,_ " Return to the form." End If End If %> <% Dim myQueryString myQueryString = " " If Request(" ID" ) = " " then myQueryString = " " else myQueryString = " (ID = ::ID::)" end if If Request(" company_name" ) > " " then If myQueryString = " " then myQueryString = " (company_name LIKE ' %::company_name::%' )" else myQueryString = myQueryString & " AND (company_name LIKE ' %::company_name::%' )" end if end if If Request(" city" ) > " " then If myQueryString = " " then myQueryString = " (city LIKE ' %::city::%' )" else myQueryString = myQueryString & " AND (city LIKE ' %::city::%' )" end if end if If Request(" province" ) > " " then If myQueryString = " " then myQueryString = " (province LIKE ' %::province::%' )" else myQueryString = myQueryString & " AND (province LIKE ' %::province::%' )" end if end if If Request(" phone_number" ) > " " then If myQueryString = " " then myQueryString = " (phone_number LIKE ' %::phone_number::%' )" else myQueryString = myQueryString & " AND (phone_number LIKE ' %::phone_number::%' )" end if end if If Request(" fax_number" ) > " " then If myQueryString = " " then myQueryString = " (fax_number LIKE ' %::fax_number::%' )" else myQueryString = myQueryString & " AND (fax_number LIKE ' %::fax_number::%' )" end if end if If Request(" line_of_business" ) > " " then If myQueryString = " " then myQueryString = " (line_of_business LIKE ' %::line_of_business::%' )" else myQueryString = myQueryString & " AND (line_of_business LIKE ' %::line_of_business::%' )" end if end if If Request(" number_of_employees" ) > " " then If myQueryString = " " then myQueryString = " (number_of_employees LIKE ' %::number_of_employees::%' )" else myQueryString = myQueryString & " AND (number_of_employees LIKE ' %::number_of_employees::%' )" end if end if If Request(" sales_volume" ) > " " then If myQueryString = " " then myQueryString = " (sales_volume LIKE ' %::sales_volume::%' )" else myQueryString = myQueryString & " AND (sales_volume LIKE ' %::sales_volume::%' )" end if end if If Request(" occupation" ) > " " then If myQueryString = " " then myQueryString = " (occupation LIKE ' %::occupation::%' )" else myQueryString = myQueryString & " AND (occupation LIKE ' %::occupation::%' )" end if end if If Request(" esi_representative" ) > " " then If myQueryString = " " then myQueryString = " (esi_representative LIKE ' %::esi_representative::%' )" else myQueryString = myQueryString & " AND (esi_representative LIKE ' %::esi_representative::%' )" end if end if
|
|
|
|