Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: ASP-SQL Server problem: rs.sort not working


Message #1 by "Amitabh" <aadhikari@p...> on Thu, 25 Jan 2001 16:44:04 -0000
I added a field to a SQL Server Database. An already-working page which

accessed this database and sorted the data based on its fields used

rs.sort. This code works with the previously existing fields but gives

this error when sorted on the new field (SubCategory)-



Provider error '80040e60' 



Order cannot be opened. 



/PMSOLDIER/lwipt/Action2/default.asp, line 74 



I couldn't find any information on Microsoft's knowledgebase regarding

this error.



These are the relevant lines of code-



SortOrder=Request.QueryString("ord")

SortField=Request.QueryString("fld")



SQLString="SELECT tblActionItems.*, tblActionStatus.StatusColor,

tblActionStatus.StatusColorCode FROM tblActionItems INNER JOIN

tblActionStatus ON tblActionItems.Status = tblActionStatus.StatusID "



Set DataConn=newDAtaConn()



Set RS = DATACONN.execute (SQLString)

RS.PageSize=tPageSize



rs.Sort = SortField & " " & SortOrder   'line 74



Line 74 is the last one - with rs.sort



These are the fields in table tblActionItems

TASKID, Status, Title, DateUpdated, DateOpened, Suspense, Summary,

Strategy, SubCategory, Comments, POCID, Active, POCName, POCEmail, POCOrg



the querystring is:    ?fld=subcategory&ord=ASC

 why does rs.sort work for all other fields but not for the newly added

one?

Amitabh



Message #2 by "Peter Lanoie" <planoie@e...> on Thu, 25 Jan 2001 12:19:11 -0500
Amitabh-



I can't see what the problem is with your code. It looks ok to me. I just

read up on the RecordSet Sort property, and again, things look ok.



One way around your problem is to bury the ordering information into the SQL

query instead of using the recordset property.  You are calling SQL anyway,

might as well bundle the work together. Plus, it's probably faster anyway.

Just add this to your query:



	" order by " & SortField & " " & SortOrder



That should take care of things.

One question on something I noticed though... how are you able to do a join

on a table that isn't in the FROM list?  Maybe that is something underlying

that's causing the problem.



Good luck.



Peter L.





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

From: Amitabh [mailto:aadhikari@p...]

Sent: Thursday, January 25, 2001 11:44 AM

To: ASP Databases

Subject: [asp_databases] ASP-SQL Server problem: rs.sort not working





I added a field to a SQL Server Database. An already-working page which

accessed this database and sorted the data based on its fields used

rs.sort. This code works with the previously existing fields but gives

this error when sorted on the new field (SubCategory)-



Provider error '80040e60'



Order cannot be opened.



/PMSOLDIER/lwipt/Action2/default.asp, line 74



I couldn't find any information on Microsoft's knowledgebase regarding

this error.



These are the relevant lines of code-



SortOrder=Request.QueryString("ord")

SortField=Request.QueryString("fld")



SQLString="SELECT tblActionItems.*, tblActionStatus.StatusColor,

tblActionStatus.StatusColorCode FROM tblActionItems INNER JOIN

tblActionStatus ON tblActionItems.Status = tblActionStatus.StatusID "



Set DataConn=newDAtaConn()



Set RS = DATACONN.execute (SQLString)

RS.PageSize=tPageSize



rs.Sort = SortField & " " & SortOrder   'line 74



Line 74 is the last one - with rs.sort



These are the fields in table tblActionItems

TASKID, Status, Title, DateUpdated, DateOpened, Suspense, Summary,

Strategy, SubCategory, Comments, POCID, Active, POCName, POCEmail, POCOrg



the querystring is:    ?fld=subcategory&ord=ASC

 why does rs.sort work for all other fields but not for the newly added

one?

Amitabh



Message #3 by "Wally Burfine" <oopconsultant@h...> on Thu, 25 Jan 2001 22:02:02 -0000
try making the case the same as in the table





>From: "Amitabh" <aadhikari@p...>

>Reply-To: "ASP Databases" <asp_databases@p...>

>To: "ASP Databases" <asp_databases@p...>

>Subject: [asp_databases] ASP-SQL Server problem: rs.sort not working

>Date: Thu, 25 Jan 2001 16:44:04 -0000

>

>I added a field to a SQL Server Database. An already-working page which

>accessed this database and sorted the data based on its fields used

>rs.sort. This code works with the previously existing fields but gives

>this error when sorted on the new field (SubCategory)-

>

>Provider error '80040e60'

>

>Order cannot be opened.

>

>/PMSOLDIER/lwipt/Action2/default.asp, line 74

>

>I couldn't find any information on Microsoft's knowledgebase regarding

>this error.

>

>These are the relevant lines of code-

>

>SortOrder=Request.QueryString("ord")

>SortField=Request.QueryString("fld")

>

>SQLString="SELECT tblActionItems.*, tblActionStatus.StatusColor,

>tblActionStatus.StatusColorCode FROM tblActionItems INNER JOIN

>tblActionStatus ON tblActionItems.Status = tblActionStatus.StatusID "

>

>Set DataConn=newDAtaConn()

>

>Set RS = DATACONN.execute (SQLString)

>RS.PageSize=tPageSize

>

>rs.Sort = SortField & " " & SortOrder   'line 74

>

>Line 74 is the last one - with rs.sort

>

>These are the fields in table tblActionItems

>TASKID, Status, Title, DateUpdated, DateOpened, Suspense, Summary,

>Strategy, SubCategory, Comments, POCID, Active, POCName, POCEmail, POCOrg

>

>the querystring is:    ?fld=subcategory&ord=ASC

>  why does rs.sort work for all other fields but not for the newly added

>one?

>Amitabh

>

>

  Return to Index