p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_codeclinic thread: Searching a recordset with 2 params


Message #1 by "David" <iluvwilai@h...> on Wed, 23 May 2001 22:48:31
Besides not working with method is very slow.
Use a Select Statement like so:
strSql = "SELECT * FROM tblOption WHERE " & strCriteria & " AND " & strCriteria2

rsOption.Open strSql, strConnect, adOpenStatic, adLockPessimistic, adCmdText

> Subject: Re: Searching a recordset with 2 params
> From: "Michael A. Michalski" <mmcihalski@n...>
> Date: Wed, 23 May 2001 20:53:50 -0400
> X-Message-Number: 2
> 
> The Find method only accepts single field data.  I quote from Pro ASP 3.0:
> 
> "We can only specify a single search value in the Criteria argument.  Using
> multiple search values with AND or OR causes an error."
> 
> I cannot explain why it works with OR as the above indicates that it should
> not.  In any event, it appears that this method will not suffice.
> 
> You may wish to look into the Filter property as it allows multiple
> criteria.
> 
> Michael
> 
> ----- Original Message -----
> From: "David" <iluvwilai@h...>
> To: "Code Clinic" <proasp_codeclinic@p...>
> Sent: Wednesday, May 23, 2001 10:48 PM
> Subject: [proasp_codeclinic] Searching a recordset with 2 params
> 
> 
> >
> > set rsOption = Server.CreateObject("ADODB.Recordset")
> > rsOption.Open "tblOption", strConnect, adOpenStatic, adLockPessimistic,
> > adCmdTable
> >
> > Dim  strCriteria, strCriteria2, strMaster, intForm
> >
> > strMaster = Request.QueryString("idkey")
> > intForm = Request.QueryString("formnbr")
> >
> > 'make the Criteria to search
> >
> > strCriteria = "MasterRecordID = '" & strMaster & "'"
> > strCriteria2 = "FormNbr=" & intForm
> > strSql = strCriteria & " AND " & strCriteria2
> >
> > 'try to find the master record id and form number
> > Response.Write strSql
> > rsOption.Find strSql
> >
> >
> > rsOption.Close
> >
> > SET rsOption = nothing
> >
> > ***********************************************
> >
> > I get the error:
> >
> > MasterRecordID='20' AND FormNbr=1 (From the response.write)
> >
> > ADODB.Recordset error '800a0bb9'
> >
> > Arguments are of the wrong type, are out of acceptable range, or are in
> > conflict with one another.
> >
> > /dialuseu.asp, line 23
> >
> > ****************************************************
> >
> > When I use strCriteria OR strCriteria2 it works!
> >
> > BUT I need both
> >
> > FormNbr is int datatype and MasterRecordID is a varchar datatype
> >
> > PLEASE HELP!!
> >
> > Thanks in Advance!
> >
> > David
> 

  Return to Index