Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Sorting and Filter Problem


Message #1 by danielmyburgh@i... on Mon, 18 Sep 2000 12:29:48 +0100
Hi 



Wel Do I hate it to be a NewBie !!

I've just started with ASP Got a good book but now I'm stuck. I'm bussy

with Sorting and filtering of records. I've got a small Access database

with three fields EmpID,FirstName,LastName

Here is the code that I use to connect to the database and use to

display,sort,filter the info.



1)    <%

2)    Option Explicit

3)    

4)    Dim NumRecordsModified

5)    dim ConnectString 

6)    dim FilterString 

7)    

8)    If IsEmpty(Session("RSEmps")) Then

9)     ConnectString = "DSN=Numbers;User Id=Admin;Password=;"

10)    Set Session("RSEmps") = server.createobject ("adodb.REcordset")

11)     Session("RSEmps").Cursorlocation = 3

12)     Session("Rsemps").open "tblEmps",ConnectString, , ,2

 13)    

14)    else

15)     session("RSEmps").MoveFirst 

16)     if not isempty(request.form("Submit")) then

17)    'session("RSEmps").sort =  request.form("SortField")

18)     if request.form("Filter") = "all" then

19)      session("rsemps").filter = "EmpID > 0"

20)    else

21)            session("rsemps").filter = "LastName =" & request.form

("Filter")

22)     end if

23)     end if

24)    end if

25)    

26)

27)    Response.Write "<TABLE>"

28)    Response.Write "<TR><B>"

29)    Response.Write "<TD>Employee ID</TD><TD>First Name</TD>" _

30)     & "<TD>Last Name</TD></B></TR>"

        Do Until Session("RSEmps").EOF

         Response.Write "<TR>"

         Response.Write "<TD>" & Session("RSEmps")("EmpID") & "</TD>"

         Response.Write "<TD>" & Session("RSEmps")("FirstName") & "</TD>"

         Response.Write "<TD>" & Session("RSEmps")("LastName") & "</TD>"

         Response.Write "</TR>"

           Session("RSEmps").MoveNext

        Loop

        Response.Write "</TABLE>"



%>

<html>

<head>

<title>Untitled Document</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>



<body bgcolor="#FFFFFF">



<form action="ASPFilterDebug.asp" method="post">

  <p><font face="Verdana, Arial, Helvetica, sans-serif">Sort: </font> 

    <select name="SortField">

      <option selected value = "EmpID">EmpID</option>

      <option value = "FirstName">FirstName</option>

      <option value = "LastName">LastName</option>

    </select>

  </p>

  <p><font face="Verdana, Arial, Helvetica, sans-serif">Filter</font> 

    <select name="Filter">

      <option selected value = "all">all</option>

      <option value = "myburgh">myburgh</option>

      <option value = "2">2</option>

      <option value = "3">3</option>

 <option value = "4">4</option>

    </select>

  </p>

  <p> </p>

  <p align="left"> 

    <input type="submit" name="Submit" value="Submit">

  </p>

</form>

<p> </p>

</body>

</html>







Here is the problem when I filter on EmpId it works in other words

when I enter  Session("RSEmps").Filter = "EmpID = " &

Request.Form("Filter")   the data are filtered. But

when I want to filter acording to Firstname or Lastname I get the

following error. ADODB Recordset error 800a0bb9 The aplication is using

arguments that are of the wrong type ,are out of range or are in conflict

with one another. this error takes place at line21



I've entered two kinds of data onto the filter selection numeric and

alphanumeric. When I filter on numeric it works if I try and filter on the

alphanumeric (like LastName|) I get the error.



The Other problem is the Sorting . When I enable the sorting line (17) I

get the error Provider error "80004001" Not implimented Line 17



Well I hope this is not as clear as mud !



Thanks a million in advance



Regards

Daniel

Message #2 by =?iso-8859-1?Q?Gonzalo_Ruiz_de_Villa_Su=E1rez?= <gonzalo.ruizdevilla@a...> on Mon, 18 Sep 2000 14:08:45 +0200
Try this



21) session("rsemps").filter = "LastName ='" & request.form("Filter") & "'"



Hope it helps

Regards,

Gonzalo





-----Mensaje original-----

De: danielmyburgh@i...

[mailto:danielmyburgh@i...]

Enviado el: lunes, 18 de septiembre de 2000 13:30

Para: ASP Databases

Asunto: [asp_databases] Sorting and Filter Problem



Hi



Wel Do I hate it to be a NewBie !!

I've just started with ASP Got a good book but now I'm stuck. I'm bussy

with Sorting and filtering of records. I've got a small Access database

with three fields EmpID,FirstName,LastName

Here is the code that I use to connect to the database and use to

display,sort,filter the info.



1)    <%

2)    Option Explicit

3)

4)    Dim NumRecordsModified

5)    dim ConnectString

6)    dim FilterString

7)

8)    If IsEmpty(Session("RSEmps")) Then

9)     ConnectString = "DSN=Numbers;User Id=Admin;Password=;"

10)    Set Session("RSEmps") = server.createobject ("adodb.REcordset")

11)     Session("RSEmps").Cursorlocation = 3

12)     Session("Rsemps").open "tblEmps",ConnectString, , ,2

 13)

14)    else

15)     session("RSEmps").MoveFirst

16)     if not isempty(request.form("Submit")) then

17)    'session("RSEmps").sort =  request.form("SortField")

18)     if request.form("Filter") = "all" then

19)      session("rsemps").filter = "EmpID > 0"

20)    else

21)            session("rsemps").filter = "LastName =" & request.form

("Filter")

22)     end if

23)     end if

24)    end if

25)

26)

27)    Response.Write "<TABLE>"

28)    Response.Write "<TR><B>"

29)    Response.Write "<TD>Employee ID</TD><TD>First Name</TD>" _

30)     & "<TD>Last Name</TD></B></TR>"



        Do Until Session("RSEmps").EOF

         Response.Write "<TR>"

         Response.Write "<TD>" & Session("RSEmps")("EmpID") & "</TD>"

         Response.Write "<TD>" & Session("RSEmps")("FirstName") & "</TD>"

         Response.Write "<TD>" & Session("RSEmps")("LastName") & "</TD>"

         Response.Write "</TR>"

           Session("RSEmps").MoveNext

        Loop

        Response.Write "</TABLE>"



%>

<html>

<head>

<title>Untitled Document</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>



<body bgcolor="#FFFFFF">



<form action="ASPFilterDebug.asp" method="post">

  <p><font face="Verdana, Arial, Helvetica, sans-serif">Sort: </font>

    <select name="SortField">

      <option selected value = "EmpID">EmpID</option>

      <option value = "FirstName">FirstName</option>

      <option value = "LastName">LastName</option>

    </select>

  </p>

  <p><font face="Verdana, Arial, Helvetica, sans-serif">Filter</font>

    <select name="Filter">

      <option selected value = "all">all</option>

      <option value = "myburgh">myburgh</option>

      <option value = "2">2</option>

      <option value = "3">3</option>

 <option value = "4">4</option>

    </select>

  </p>

  <p> </p>

  <p align="left">

    <input type="submit" name="Submit" value="Submit">

  </p>

</form>

<p> </p>



---<BR>

You are currently subscribed to asp_databases <BR>


</BODY>

</html>







Here is the problem when I filter on EmpId it works in other words

when I enter  Session("RSEmps").Filter = "EmpID = " &

Request.Form("Filter")   the data are filtered. But

when I want to filter acording to Firstname or Lastname I get the

following error. ADODB Recordset error 800a0bb9 The aplication is using

arguments that are of the wrong type ,are out of range or are in conflict



with one another. this error takes place at line21



I've entered two kinds of data onto the filter selection numeric and

alphanumeric. When I filter on numeric it works if I try and filter on the

alphanumeric (like LastName|) I get the error.



The Other problem is the Sorting . When I enable the sorting line (17) I

get the error Provider error "80004001" Not implimented Line 17



Well I hope this is not as clear as mud !



Thanks a million in advance



Regards

Daniel




  Return to Index