Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Recordset Error


Message #1 by Tim Brooks <TBrooks@c...> on Mon, 18 Dec 2000 20:44:24 -0500
This message is in MIME format. Since your mail reader does not understand

this format, some or all of this message may not be legible.



------_=_NextPart_001_01C0695D.38DFC33C

Content-Type: text/plain;

	charset="iso-8859-1"



I'm trying to write a simple application that does a search on a database

based on user input.

the database can be searched by the following fields:

zip,city,county,state,agentname,agentcode.

I'm using three screens to do this:

  the first screen ask how they would like to retrieve the information

  the second screen verifies what the user wants and asks for i/p via a text

box(ie..where they   

      would enter the data zip(12345) or state(oh) or name(smith agency)).

this page passes the

     user 's  i/p along with a hidden

      field that will be used to identify what was in the text box.

  the third screen actually does the db lookup and returns data

the problem is that this works fine for a zip or agentcode lookup but errors

out when i try using any of the other fields.

 

the error message

*	Error Type:

ADODB.Recordset (0x800A0BB9)

Arguments are of the wrong type, are out of acceptable range, or are in

conflict with one another.

/employees/recordset.asp, line 28







*	Browser Type:

Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0) 





*	Page:

POST 44 bytes to /employees/recordset.asp 





*	POST Data:

stuff=cincinnati&lufield=City&submit1=Submit 





*	Time:

Monday, December 18, 2000, 8:26:39 PM  

 

 

page 2 code

 <%option explicit dim strconnect %> <%option explicit

   dim strconnect

%>

<!-- #include file="datastore.asp" -->

<html>

<head>

<title>Agency Lookup verify and sen routine</title>

</head>

<body>

  You would like to do a search by 

  

  <%

     Response.Write Request.Form("typeselect")

     Response.Write(" for ")

     Response.Write Request.Form("productselect")

     

  %>

  <form method=post action="recordset.asp" id=form1 name=form1>

  if this is correct<br>

  <br> 

  <%  dim strtypechoice, strproductchoice, inthold 

  strtypechoice     = Request.form("typeselect")

  strproductchoice  = Request.Form("productselect")

  select case strtypechoice

     case "Zip Code"

          inthold = 10

          Response.Write "Please enter the Desired Zip code "

          Response.Write "<input type='text' size=5 id=select2

name='stuff'>"

          Response.write "<INPUT type='hidden' id=submit1 name=lufield

value='zip5digit'>"

     case "City"

          inthold = 20

          Response.Write "Please enter the Desired City "

          Response.Write "<input type='text' size=15 id=select2

name='stuff'>"

          Response.write "<INPUT type='hidden' id=submit1 name=lufield

value='City'>"

     case "County"

          inthold = 30

          Response.Write "Please enter the Desired County "

          Response.Write "<input type='text' size=15 id=select2

name='stuff'>"

          Response.write "<INPUT type='hidden' id=submit1 name=lufield

value='county'>"

     case "State"

          inthold = 40

          Response.Write "Please enter the Desired State "

          Response.Write "<input type='text' size=2 id=select2

name='stuff'>"

          Response.write "<INPUT type='hidden' id=submit1 name=lufield

value='state'>" 

     case "Agency Name"

          inthold = 50

          Response.Write "Please enter the Desired Agency Name "

          Response.Write "<input type='text' size=25 id=select2

name='stuff'>"

          Response.write "<INPUT type='hidden' id=submit1 name=lufield

value='agencyname'>"

     case "Agency Code"

          inthold = 60

          Response.Write "Please enter the Desired Agency Code "

          Response.Write "<input type='text' size=7 id=select2

name='stuff'>"

          Response.write "<INPUT type='hidden' id=submit1 name=lufield

value='code'>"

     case "none"

          inthold = 70

   End Select   

 

  select case strproductchoice

     case "All Products"

          inthold = inthold + 1 

     case "Preferred Home Owners Only"

          inthold = inthold + 2      

     case "Preferred Personal Auto Only"

          inthold = inthold + 3 

     case "All Non-Standard Products"

          inthold = inthold + 4

     case "Non-Standard Home Owners Only"

          inthold = inthold + 5 

     case "Non-Standard Personal Auto Only"

          inthold = inthold + 6      

           

 

  end select

 

Response.Write "and hit submit<br> else hit reset to return to the lookup

screen" & inthold

 

%>

 

 

 

<!-- <input type="text" size=5 id=select2 name="zipcode">

-->  

<div align="center">

<INPUT type="submit" value="Submit" id=submit1 name=submit1>

<INPUT type="reset" value="Reset" id=reset1 name=reset1>

</div>

</form>

 



---<BR>

FREE WEB DEVELOPMENT CODE, CONTENT, AND INSIGHTS<BR>

IN YOUR INBOX!<BR>

Get the latest and best HTML, XML, and JavaScript tips, tools, and <BR>

developments from the experts.  Sign up for one or more of EarthWeb's<BR>

FREE IT newsletters at http://www.earthweb.com today!  <BR>

---<BR>

You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')<BR>

To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com<BR>



</BODY>

</html>





page 3 code

<% dim strtypechoice, strproductchoice, inthold strtypechoice 

Request.form("typeselect") strproductchoice = Request.Form("productselect")

select case strtypechoice case "Zip Code" inthold = 10 Response.Write

"Please enter the Desired Zip code " Response.Write "" Response.write ""

case "City" inthold = 20 Response.Write "Please enter the Desired City "

Response.Write "" Response.write "" case "County" inthold = 30

Response.Write "Please enter the Desired County " Response.Write ""

Response.write "" case "State" inthold = 40 Response.Write "Please enter the

Desired State " Response.Write "" Response.write "" case "Agency Name"

inthold = 50 Response.Write "Please enter the Desired Agency Name "

Response.Write "" Response.write "" case "Agency Code" inthold = 60

Response.Write "Please enter the Desired Agency Code " Response.Write ""

Response.write "" case "none" inthold = 70 End Select select case

strproductchoice case "All Products" inthold = inthold + 1 case "Preferred

Home Owners Only" inthold = inthold + 2 case "Preferred Personal Auto Only"

inthold = inthold + 3 case "All Non-Standard Products" inthold = inthold + 4

case "Non-Standard Home Owners Only" inthold = inthold + 5 case

"Non-Standard Personal Auto Only" inthold = inthold + 6 end select

Response.Write "and hit submit

else hit reset to return to the lookup screen" & inthold %> <%option

explicit dim strconnect %> 

<%option explicit

   dim strconnect

%>

<!-- #include file="datastore.asp" --> 

<!-- metadata type="typelib"

              File="c:\program files\common files\system\ado\msado15.dll"

-->

 

<html>

<head>

<title>Using the Find Method to lookup agenct Information</title>

</head>

<body>

<%

  'const adOpenForwardOnly = 0                                      comment

  'const adLockReadOnly = 1

comment

  'const adCmdTable = 2

comment

  dim strDirector, strCriteria, strlufield, strstuff

  strlufield = Request.Form("lufield")

  strstuff = Request.Form("stuff")

  

  dim objRS

  set objRs = Server.CreateObject("adodb.recordset")

    objRS.Open "allagencytable", strConnect, _

   adOpenStatic, adLockReadOnly, adCmdTable                

  

  strCriteria = strlufield & " = " & strstuff  

  Response.write strCriteria

  objRS.Filter = strCriteria

line 28  

  'Response.Write "lufield value" & Request.form("lufield")        comment  

  if not objRS.EOF then

     Response.Write "found at least one record<br>"

     while not objRS.eof

       

     Response.Write objRS("agencyname") & "<br>"

     Response.Write objRS("agencystre") & "<br>"

     Response.Write objRS("city") & ", "

     Response.Write objRS("state") & ", "

     Response.Write objRS("zip5digit") & "<br>"

     Response.Write objRS("code") & "<br><br>"

     objRS.MoveNext

     wend

  end if     

  

  objRS.Close

  set objRS = nothing

  

%>

 



---<BR>

FREE WEB DEVELOPMENT CODE, CONTENT, AND INSIGHTS<BR>

IN YOUR INBOX!<BR>

Get the latest and best HTML, XML, and JavaScript tips, tools, and <BR>

developments from the experts.  Sign up for one or more of EarthWeb's<BR>

FREE IT newsletters at http://www.earthweb.com today!  <BR>

---<BR>

You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')<BR>

To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com<BR>



</BODY>

</html>



 

 

 

 



Timothy S. Brooks 

tbrooks@c... <mailto:tbrooks@c...> 



ext. 365 

  



 




Message #2 by "Dave Sussman" <davids@i...> on Tue, 19 Dec 2000 08:55:48 -0000
If you're searching for a string field, you need to enclose it in quotes.

Try



strCriteria = strlufield & " = '" & strstuff  & "'"



This makes sure that the contents of strstuff are contained within single

quotes.



Dave





"Tim Brooks" <TBrooks@c...> wrote in message

news:26297@a..._databases...

>

> This message is in MIME format. Since your mail reader does not understand

> this format, some or all of this message may not be legible.

>

> ------_=_NextPart_001_01C0695D.38DFC33C

> Content-Type: text/plain;

> charset="iso-8859-1"

>

> I'm trying to write a simple application that does a search on a database

> based on user input.

> the database can be searched by the following fields:

> zip,city,county,state,agentname,agentcode.

> I'm using three screens to do this:

>   the first screen ask how they would like to retrieve the information

>   the second screen verifies what the user wants and asks for i/p via a

text

> box(ie..where they

>       would enter the data zip(12345) or state(oh) or name(smith agency)).

> this page passes the

>      user 's  i/p along with a hidden

>       field that will be used to identify what was in the text box.

>   the third screen actually does the db lookup and returns data

> the problem is that this works fine for a zip or agentcode lookup but

errors

> out when i try using any of the other fields.

>

> the error message

> * Error Type:

> ADODB.Recordset (0x800A0BB9)

> Arguments are of the wrong type, are out of acceptable range, or are in

> conflict with one another.

> /employees/recordset.asp, line 28

>

>

>

> * Browser Type:

> Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0)

>

>

> * Page:

> POST 44 bytes to /employees/recordset.asp

>

>

> * POST Data:

> stuff=cincinnati&lufield=City&submit1=Submit

>

>

> * Time:

> Monday, December 18, 2000, 8:26:39 PM

>

>

> page 2 code

>  <%option explicit dim strconnect %> <%option explicit

>    dim strconnect

> %>

> <!-- #include file="datastore.asp" -->

> <html>

> <head>

> <title>Agency Lookup verify and sen routine</title>

> </head>

> <body>

>   You would like to do a search by

>

>   <%

>      Response.Write Request.Form("typeselect")

>      Response.Write(" for ")

>      Response.Write Request.Form("productselect")

>

>   %>

>   <form method=post action="recordset.asp" id=form1 name=form1>

>   if this is correct<br>

>   <br>

>   <%  dim strtypechoice, strproductchoice, inthold

>   strtypechoice     = Request.form("typeselect")

>   strproductchoice  = Request.Form("productselect")

>   select case strtypechoice

>      case "Zip Code"

>           inthold = 10

>           Response.Write "Please enter the Desired Zip code "

>           Response.Write "<input type='text' size=5 id=select2

> name='stuff'>"

>           Response.write "<INPUT type='hidden' id=submit1 name=lufield

> value='zip5digit'>"

>      case "City"

>           inthold = 20

>           Response.Write "Please enter the Desired City "

>           Response.Write "<input type='text' size=15 id=select2

> name='stuff'>"

>           Response.write "<INPUT type='hidden' id=submit1 name=lufield

> value='City'>"

>      case "County"

>           inthold = 30

>           Response.Write "Please enter the Desired County "

>           Response.Write "<input type='text' size=15 id=select2

> name='stuff'>"

>           Response.write "<INPUT type='hidden' id=submit1 name=lufield

> value='county'>"

>      case "State"

>           inthold = 40

>           Response.Write "Please enter the Desired State "

>           Response.Write "<input type='text' size=2 id=select2

> name='stuff'>"

>           Response.write "<INPUT type='hidden' id=submit1 name=lufield

> value='state'>"

>      case "Agency Name"

>           inthold = 50

>           Response.Write "Please enter the Desired Agency Name "

>           Response.Write "<input type='text' size=25 id=select2

> name='stuff'>"

>           Response.write "<INPUT type='hidden' id=submit1 name=lufield

> value='agencyname'>"

>      case "Agency Code"

>           inthold = 60

>           Response.Write "Please enter the Desired Agency Code "

>           Response.Write "<input type='text' size=7 id=select2

> name='stuff'>"

>           Response.write "<INPUT type='hidden' id=submit1 name=lufield

> value='code'>"

>      case "none"

>           inthold = 70

>    End Select

>

>   select case strproductchoice

>      case "All Products"

>           inthold = inthold + 1

>      case "Preferred Home Owners Only"

>           inthold = inthold + 2

>      case "Preferred Personal Auto Only"

>           inthold = inthold + 3

>      case "All Non-Standard Products"

>           inthold = inthold + 4

>      case "Non-Standard Home Owners Only"

>           inthold = inthold + 5

>      case "Non-Standard Personal Auto Only"

>           inthold = inthold + 6

>

>

>   end select

>

> Response.Write "and hit submit<br> else hit reset to return to the lookup

> screen" & inthold

>

> %>

>

>

>

> <!-- <input type="text" size=5 id=select2 name="zipcode">

> -->

> <div align="center">

> <INPUT type="submit" value="Submit" id=submit1 name=submit1>

> <INPUT type="reset" value="Reset" id=reset1 name=reset1>

> </div>

> </form>

>

>

> ---<BR>

> FREE WEB DEVELOPMENT CODE, CONTENT, AND INSIGHTS<BR>

> IN YOUR INBOX!<BR>

> Get the latest and best HTML, XML, and JavaScript tips, tools, and <BR>

> developments from the experts.  Sign up for one or more of EarthWeb's<BR>

> FREE IT newsletters at http://www.earthweb.com today!  <BR>

> ---<BR>


$subst('Recip.EmailAddr')<BR>


leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com<BR>

>

> 

--- <BR>

FREE SOFTWARE DEVELOPMENT CODE, CONTENT, AND<BR>

INSIGHTS IN YOUR INBOX!<BR>

Get the latest and best C++, Visual C++, Java, Visual Basic, and XML tips, tools, and <BR>

developments from the experts.  Sign up for one or more of EarthWeb?s<BR>

FREE IT newsletters at http://www.earthweb.com today!  <BR>

---<BR>

You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')<BR>

To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com<BR>



</BODY>

> </html>

>

>

> page 3 code

> <% dim strtypechoice, strproductchoice, inthold strtypechoice 

> Request.form("typeselect") strproductchoice 

Request.Form("productselect")

> select case strtypechoice case "Zip Code" inthold = 10 Response.Write

> "Please enter the Desired Zip code " Response.Write "" Response.write ""

> case "City" inthold = 20 Response.Write "Please enter the Desired City "

> Response.Write "" Response.write "" case "County" inthold = 30

> Response.Write "Please enter the Desired County " Response.Write ""

> Response.write "" case "State" inthold = 40 Response.Write "Please enter

the

> Desired State " Response.Write "" Response.write "" case "Agency Name"

> inthold = 50 Response.Write "Please enter the Desired Agency Name "

> Response.Write "" Response.write "" case "Agency Code" inthold = 60

> Response.Write "Please enter the Desired Agency Code " Response.Write ""

> Response.write "" case "none" inthold = 70 End Select select case

> strproductchoice case "All Products" inthold = inthold + 1 case "Preferred

> Home Owners Only" inthold = inthold + 2 case "Preferred Personal Auto

Only"

> inthold = inthold + 3 case "All Non-Standard Products" inthold = inthold +

4

> case "Non-Standard Home Owners Only" inthold = inthold + 5 case

> "Non-Standard Personal Auto Only" inthold = inthold + 6 end select

> Response.Write "and hit submit

> else hit reset to return to the lookup screen" & inthold %> <%option

> explicit dim strconnect %>

> <%option explicit

>    dim strconnect

> %>

> <!-- #include file="datastore.asp" -->

> <!-- metadata type="typelib"

>               File="c:\program files\common files\system\ado\msado15.dll"

> -->

>

> <html>

> <head>

> <title>Using the Find Method to lookup agenct Information</title>

> </head>

> <body>

> <%

>   'const adOpenForwardOnly = 0

comment

>   'const adLockReadOnly = 1

> comment

>   'const adCmdTable = 2

> comment

>   dim strDirector, strCriteria, strlufield, strstuff

>   strlufield = Request.Form("lufield")

>   strstuff = Request.Form("stuff")

>

>   dim objRS

>   set objRs = Server.CreateObject("adodb.recordset")

>     objRS.Open "allagencytable", strConnect, _

>    adOpenStatic, adLockReadOnly, adCmdTable

>

>   strCriteria = strlufield & " = " & strstuff

>   Response.write strCriteria

>   objRS.Filter = strCriteria

> line 28

>   'Response.Write "lufield value" & Request.form("lufield")        comment

>   if not objRS.EOF then

>      Response.Write "found at least one record<br>"

>      while not objRS.eof

>

>      Response.Write objRS("agencyname") & "<br>"

>      Response.Write objRS("agencystre") & "<br>"

>      Response.Write objRS("city") & ", "

>      Response.Write objRS("state") & ", "

>      Response.Write objRS("zip5digit") & "<br>"

>      Response.Write objRS("code") & "<br><br>"

>      objRS.MoveNext

>      wend

>   end if

>

>   objRS.Close

>   set objRS = nothing

>

> %>

>

>

> ---<BR>

> FREE WEB DEVELOPMENT CODE, CONTENT, AND INSIGHTS<BR>

> IN YOUR INBOX!<BR>

> Get the latest and best HTML, XML, and JavaScript tips, tools, and <BR>

> developments from the experts.  Sign up for one or more of EarthWeb's<BR>

> FREE IT newsletters at http://www.earthweb.com today!  <BR>

> ---<BR>


$subst('Recip.EmailAddr')<BR>


leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com<BR>

>

> 

--- <BR>

FREE SOFTWARE DEVELOPMENT CODE, CONTENT, AND<BR>

INSIGHTS IN YOUR INBOX!<BR>

Get the latest and best C++, Visual C++, Java, Visual Basic, and XML tips, tools, and <BR>

developments from the experts.  Sign up for one or more of EarthWeb?s<BR>

FREE IT newsletters at http://www.earthweb.com today!  <BR>

---<BR>

You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')<BR>

To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com<BR>



</BODY>

> </html>

>

>

>

>

>

>

> Timothy S. Brooks

> tbrooks@c... <mailto:tbrooks@c...>

>

> ext. 365

>

>

>

>

> ------_=_NextPart_001_01C0695D.38DFC33C

> Content-Type: text/html;

> charset="iso-8859-1"

>

> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

> <HTML><HEAD>

> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">

>

>

> <META content="MSHTML 5.50.4134.600" name=GENERATOR></HEAD>

> <BODY>

> <DIV><SPAN class=994371901-19122000><FONT face=Arial size=2>I'm trying to

write

> a simple application that does a search on a database based on user

> input.</FONT></SPAN></DIV>

> <DIV><SPAN class=994371901-19122000><FONT face=Arial size=2>the database

can be

> searched by the following fields:

> zip,city,county,state,agentname,agentcode.</FONT></SPAN></DIV>

> <DIV><SPAN class=994371901-19122000><FONT face=Arial size=2>I'm using

three

> screens to do this:</FONT></SPAN></DIV>

> <DIV><SPAN class=994371901-19122000><FONT face=Arial size=2>  the

first

> screen ask how they would like to retrieve the

information</FONT></SPAN></DIV>

> <DIV><SPAN class=994371901-19122000><FONT face=Arial size=2>  the

second

> screen verifies what the user wants and asks for i/p via a text

box(ie..where

> they   </FONT></SPAN></DIV>

> <DIV><SPAN class=994371901-19122000><FONT face=Arial

> size=2>      would enter the data zip(12345) or

> state(oh) or name(smith agency)). this page passes the</FONT></SPAN></DIV>

> <DIV><SPAN class=994371901-19122000><FONT face=Arial size=2>  

 

> user 's  i/p along with a hidden</FONT></SPAN></DIV>

> <DIV><SPAN class=994371901-19122000><FONT face=Arial

> size=2>      field that will be used to identify

what

> was in the text box.</FONT></SPAN></DIV>

> <DIV><SPAN class=994371901-19122000><FONT face=Arial size=2>  the

third

> screen actually does the db lookup and returns data</FONT></SPAN></DIV>

> <DIV><SPAN class=994371901-19122000><FONT face=Arial size=2>the problem is

that

> this works fine for a zip or agentcode lookup but errors out when i

try

> using any of the other fields.</FONT></SPAN></DIV>

> <DIV><SPAN class=994371901-19122000><FONT face=Arial

> size=2></FONT></SPAN> </DIV>

> <DIV><SPAN class=994371901-19122000><FONT face=Arial color=#008000

> size=4><STRONG>the error message</STRONG></FONT></SPAN></DIV>

> <DIV><SPAN class=994371901-19122000>

> <LI>Error Type:<BR>ADODB.Recordset (0x800A0BB9)<BR>Arguments are of the

wrong

> type, are out of acceptable range, or are in conflict with one

> another.<BR><B>/employees/recordset.asp, line 28</B><BR>

> <P></P>

> <LI>Browser Type:<BR>Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0)

> <P></P>

> <LI>Page:<BR>POST 44 bytes to /employees/recordset.asp

> <P></P>

> <LI>POST Data:<BR>stuff=cincinnati&lufield=City&submit1=Submit

> <P></P>

> <LI>Time:<BR>Monday, December 18, 2000, 8:26:39 PM  </LI></DIV>

> <DIV><FONT face=Arial size=2></FONT> </DIV>

> <DIV><FONT face=Arial size=2></FONT> </DIV>

> <DIV><FONT face=Arial color=#008000 size=5><SPAN

> class=994371901-19122000><STRONG>page 2 code</STRONG></SPAN></FONT></DIV>

> <DIV><FONT face=Arial size=2> <%option explicit

>    dim strconnect

> %><FONT size=3><FONT face="Times New Roman"> <FONT face=Arial

> size=2><%option explicit<BR>   dim

strconnect<BR>%><BR><!--

> #include file="datastore.asp"

> --><BR><html><BR><head><BR><title>Agency Lookup

verify and

> sen routine</title><BR></head><BR><body><BR>  You

would

> like to do a search by <BR>  <BR> 

<%<BR>    

> Response.Write Request.Form("typeselect")<BR>    

> Response.Write(" for ")<BR>     Response.Write

> Request.Form("productselect")<BR>     <BR> 

> %><BR>  <form method=post action="recordset.asp" id=form1

> name=form1><BR>  if this is correct<br><BR>  <br>

> <BR>  <%  dim strtypechoice, strproductchoice, inthold

<BR> 

> strtypechoice     

Request.form("typeselect")<BR> 

> strproductchoice  = Request.Form("productselect")<BR>  select

case

> strtypechoice<BR>     case "Zip

> Code"<BR>          inthold 

> 10<BR>         

Response.Write

> "Please enter the Desired Zip code

> "<BR>          Response.Write

> "<input type='text' size=5 id=select2

>

name='stuff'>"<BR>         

> Response.write "<INPUT type='hidden' id=submit1 name=lufield

> value='zip5digit'>"<BR>     case

> "City"<BR>          inthold 

> 20<BR>         

Response.Write

> "Please enter the Desired City

> "<BR>          Response.Write

> "<input type='text' size=15 id=select2

>

name='stuff'>"<BR>         

> Response.write "<INPUT type='hidden' id=submit1 name=lufield

> value='City'>"<BR>     case

> "County"<BR>          inthold



> 30<BR>         

Response.Write

> "Please enter the Desired County

> "<BR>          Response.Write

> "<input type='text' size=15 id=select2

>

name='stuff'>"<BR>         

> Response.write "<INPUT type='hidden' id=submit1 name=lufield

> value='county'>"<BR>     case

> "State"<BR>          inthold



> 40<BR>         

Response.Write

> "Please enter the Desired State

> "<BR>          Response.Write

> "<input type='text' size=2 id=select2

>

name='stuff'>"<BR>         

> Response.write "<INPUT type='hidden' id=submit1 name=lufield

> value='state'>" <BR>     case "Agency

> Name"<BR>          inthold 

> 50<BR>         

Response.Write

> "Please enter the Desired Agency Name

> "<BR>          Response.Write

> "<input type='text' size=25 id=select2

>

name='stuff'>"<BR>         

> Response.write "<INPUT type='hidden' id=submit1 name=lufield

> value='agencyname'>"<BR>     case "Agency

> Code"<BR>          inthold 

> 60<BR>         

Response.Write

> "Please enter the Desired Agency Code

> "<BR>          Response.Write

> "<input type='text' size=7 id=select2

>

name='stuff'>"<BR>         

> Response.write "<INPUT type='hidden' id=submit1 name=lufield

> value='code'>"<BR>     case

> "none"<BR>          inthold 

> 70<BR>   End

> Select   </FONT></FONT></FONT></FONT></DIV>

> <DIV> </DIV>

> <DIV><FONT face=Arial size=2><FONT size=3><FONT face="Times New

Roman"><FONT

> face=Arial size=2>  select case

> strproductchoice<BR>     case "All

> Products"<BR>         

inthold 

> inthold + 1 <BR>     case "Preferred Home Owners

> Only"<BR>          inthold 

> inthold + 2      <BR>    

case

> "Preferred Personal Auto

> Only"<BR>          inthold 

> inthold + 3 <BR>     case "All Non-Standard

> Products"<BR>         

inthold 

> inthold + 4<BR>     case "Non-Standard Home Owners

> Only"<BR>          inthold 

> inthold + 5 <BR>     case "Non-Standard Personal Auto

> Only"<BR>          inthold 

> inthold + 6     

> <BR>          

> <BR> <BR>  end select</FONT></FONT></FONT></FONT></DIV>

> <DIV> </DIV>

> <DIV><FONT face=Arial size=2><FONT size=3><FONT face="Times New

Roman"><FONT

> face=Arial size=2>Response.Write "and hit submit<br> else hit reset

to

> return to the lookup screen" &

inthold</FONT></FONT></FONT></FONT></DIV>

> <DIV> </DIV>

> <DIV><FONT face=Arial size=2><FONT size=3><FONT face="Times New

Roman"><FONT

> face=Arial size=2>%></FONT></FONT></FONT></FONT></DIV>

> <DIV> </DIV>

> <DIV><FONT face=Arial size=2><FONT size=3><FONT face="Times New

Roman"><FONT

> face=Arial size=2></FONT></FONT></FONT></FONT> </DIV>

> <DIV> </DIV>

> <DIV><FONT face=Arial size=2><FONT size=3><FONT face="Times New

Roman"><FONT

> face=Arial size=2><!-- <input type="text" size=5 id=select2

> name="zipcode"><BR>-->  <BR><div

align="center"><BR><INPUT

> type="submit" value="Submit" id=submit1 name=submit1><BR><INPUT

> type="reset" value="Reset" id=reset1

>

name=reset1><BR></div><BR></form><BR> <BR></body><

BR></html><BR></FONT></FONT></FONT></DIV>

> <DIV><BR><SPAN class=994371901-19122000><STRONG><FONT color=#008000

size=5>page

> 3 code</FONT></STRONG></SPAN><BR><%  dim strtypechoice, strproductchoice,

inthold

>   strtypechoice     = Request.form("typeselect")

>   strproductchoice  = Request.Form("productselect")

>   select case strtypechoice

>      case "Zip Code"

>           inthold = 10

>           Response.Write "Please enter the Desired Zip code "

>           Response.Write "<input type='text' size=5 id=select2

name='stuff'>"

>           Response.write "<INPUT type='hidden' id=submit1 name=lufield

value='zip5digit'>"

>      case "City"

>           inthold = 20

>           Response.Write "Please enter the Desired City "

>           Response.Write "<input type='text' size=15 id=select2

name='stuff'>"

>           Response.write "<INPUT type='hidden' id=submit1 name=lufield

value='City'>"

>      case "County"

>           inthold = 30

>           Response.Write "Please enter the Desired County "

>           Response.Write "<input type='text' size=15 id=select2

name='stuff'>"

>           Response.write "<INPUT type='hidden' id=submit1 name=lufield

value='county'>"

>      case "State"

>           inthold = 40

>           Response.Write "Please enter the Desired State "

>           Response.Write "<input type='text' size=2 id=select2

name='stuff'>"

>           Response.write "<INPUT type='hidden' id=submit1 name=lufield

value='state'>"

>      case "Agency Name"

>           inthold = 50

>           Response.Write "Please enter the Desired Agency Name "

>           Response.Write "<input type='text' size=25 id=select2

name='stuff'>"

>           Response.write "<INPUT type='hidden' id=submit1 name=lufield

value='agencyname'>"

>      case "Agency Code"

>           inthold = 60

>           Response.Write "Please enter the Desired Agency Code "

>           Response.Write "<input type='text' size=7 id=select2

name='stuff'>"

>           Response.write "<INPUT type='hidden' id=submit1 name=lufield

value='code'>"

>      case "none"

>           inthold = 70

>    End Select

>

>   select case strproductchoice

>      case "All Products"

>           inthold = inthold + 1

>      case "Preferred Home Owners Only"

>           inthold = inthold + 2

>      case "Preferred Personal Auto Only"

>           inthold = inthold + 3

>      case "All Non-Standard Products"

>           inthold = inthold + 4

>      case "Non-Standard Home Owners Only"

>           inthold = inthold + 5

>      case "Non-Standard Personal Auto Only"

>           inthold = inthold + 6

>

>

>   end select

>

> Response.Write "and hit submit<br> else hit reset to return to the lookup

screen" & inthold

>

> %> <%option explicit

>    dim strconnect

> %> <!-- #include file="datastore.asp" --></DIV></FONT>

> <DIV><FONT face=Arial size=2><%option explicit<BR>   dim

> strconnect<BR>%><BR><!-- #include file="datastore.asp" -->

<BR><!--

> metadata

>

type="typelib"<BR>         &nbs

p;   

> File="c:\program files\common

files\system\ado\msado15.dll" --></FONT></DIV>

> <DIV> </DIV>

> <DIV><FONT face=Arial

size=2><html><BR><head><BR><title>Using

> the Find Method to lookup agenct

>

Information</title><BR></head><BR><body><BR><%<BR> 

;

> 'const adOpenForwardOnly = 0<SPAN

>

class=994371901-19122000>        &nb

sp;            &

nbsp;            

;   

> comment</SPAN><BR>  'const adLockReadOnly = 1<SPAN

>

class=994371901-19122000>        &nb

sp;            &

nbsp;            

;        

> comment</SPAN><BR>  'const adCmdTable = 2<SPAN

>

class=994371901-19122000>        &nb

sp;            &

nbsp;            

;            &nb

sp;  

> comment</SPAN><BR>  dim strDirector, strCriteria, strlufield,

> strstuff<BR>  strlufield = Request.Form("lufield")<BR>  strstuff



> Request.Form("stuff")<BR>  <BR>  dim objRS<BR>  set objRs 

> Server.CreateObject("adodb.recordset")<BR>    objRS.Open

> "allagencytable", strConnect, _<BR>   adOpenStatic,

adLockReadOnly,

>

adCmdTable           

    

> <BR>  <BR>  strCriteria = strlufield & " = " &

strstuff 

> <BR>  Response.write strCriteria<BR>  <FONT

> color=#000080><STRONG>objRS.Filter = strCriteria<SPAN

>

class=994371901-19122000>        &nb

sp;            &

nbsp;            

;            &nb

sp;  

> line 28</SPAN></STRONG></FONT>  <BR>  'Response.Write

"lufield

> value" & Request.form("lufield")<SPAN

> class=994371901-19122000>       

> comment</SPAN>  <BR>  if not objRS.EOF

> then<BR>     Response.Write "found at least one

> record<br>"<BR>     while not

> objRS.eof<BR>      

<BR>    

> Response.Write objRS("agencyname") &

> "<br>"<BR>     Response.Write

objRS("agencystre")

> & "<br>"<BR>     Response.Write

objRS("city")

> & ", "<BR>     Response.Write objRS("state") &

",

> "<BR>     Response.Write objRS("zip5digit") &

> "<br>"<BR>     Response.Write objRS("code")

&

> "<br><br>"<BR>    

> objRS.MoveNext<BR>     wend<BR>  end

> if     <BR>  <BR>  objRS.Close<BR>  set

objRS

> = nothing<BR>  <BR>%></FONT></DIV>

> <DIV> </DIV>

> <DIV><FONT face=Arial

size=2></body><BR></html><BR></FONT></DIV>

> <DIV><FONT face=Arial size=2></FONT> </DIV>

> <DIV><FONT face=Arial size=2></FONT> </DIV>

> <DIV><FONT face=Arial size=2></FONT> </DIV>

> <DIV><FONT face=Arial size=2></FONT></SPAN> </DIV>

> <P><B><I><FONT face="Comic Sans MS" size=2>Timothy S.

Brooks</FONT></I></B>

> <BR><B><I><FONT face="Comic Sans MS" size=2><A

>

href="mailto:tbrooks@c...">tbrooks@c...

m</A></FONT></I></B></P>

> <P><B><I><FONT face="Comic Sans MS" size=2>ext. 365</FONT></I></B>

> <BR><B><I><FONT face="Comic Sans MS" size=2> </FONT></I></B> </P>

> <DIV><FONT face=Arial size=2></FONT><FONT face=Arial

> size=2></FONT> </DIV>

> ---<BR>

> FREE WEB DEVELOPMENT CODE, CONTENT, AND INSIGHTS<BR>

> IN YOUR INBOX!<BR>

> Get the latest and best HTML, XML, and JavaScript tips, tools, and <BR>

> developments from the experts.  Sign up for one or more of EarthWeb's<BR>

> FREE IT newsletters at http://www.earthweb.com today!  <BR>

> ---<BR>


$subst('Recip.EmailAddr')<BR>


leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com<BR>

>

> 

--- <BR>

FREE SOFTWARE DEVELOPMENT CODE, CONTENT, AND<BR>

INSIGHTS IN YOUR INBOX!<BR>

Get the latest and best C++, Visual C++, Java, Visual Basic, and XML tips, tools, and <BR>

developments from the experts.  Sign up for one or more of EarthWeb?s<BR>

FREE IT newsletters at http://www.earthweb.com today!  <BR>

---<BR>

You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')<BR>

To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com<BR>



</BODY></HTML>

>

> ------_=_NextPart_001_01C0695D.38DFC33C--

>

>





Message #3 by Tim Brooks <TBrooks@c...> on Tue, 19 Dec 2000 11:35:44 -0500
Thanks Dave that did it



-----Original Message-----

From: Dave Sussman [mailto:davids@i...]

Sent: Tuesday, December 19, 2000 3:56 AM

To: ASP Databases

Subject: [asp_databases] Re: Recordset Error





If you're searching for a string field, you need to enclose it in quotes.

Try



strCriteria = strlufield & " = '" & strstuff  & "'"



This makes sure that the contents of strstuff are contained within single

quotes.



Dave













--- 

FREE SOFTWARE DEVELOPMENT CODE, CONTENT, AND

INSIGHTS IN YOUR INBOX!

Get the latest and best C++, Visual C++, Java, Visual Basic, and XML tips, tools, and 

developments from the experts.  Sign up for one or more of EarthWeb?s

FREE IT newsletters at http://www.earthweb.com today!  

---

You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')

To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com


  Return to Index