CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Order By - In SQL Server 2000

Print topic Send  topic

Author Message
Daniel
Posted: 05/09/2002, 5:57 AM

Hi,
I'm evaluating CodeCharge Studio.
When I try to order a grid/combo ... I'm getting the following error :

Error Type:
Microsoft OLE DB Provider for SQL Server (0x80040E14)
The ORDER BY clause is invalid in views, inline functions, derived tables, and subqueries, unless TOP is also specified.
/Test4/Classes.asp, line 1412
CodeCharge Support
Posted: 05/09/2002, 7:11 AM

Daniel,
the problem is cause by using Order By clause in subquery (subquery is used in count records query). The problem is db related, e.g. Access accepts "order by" in subqueries but MSSQL not. We're lookking into and problem will be solved in next release.
For the time being you can exclude "order by" from query by yourself. As CC Studio has code editor you can look at Classes.asp and slightly modify Get RecordsCount() property if you are quite familiar to ASP.
nong
Posted: 05/10/2002, 9:14 AM

please help me...
Nicole
Posted: 05/13/2002, 2:47 AM

Hello,
what kind of help do you need? Do you mean help with asp code?
nong
Posted: 05/13/2002, 10:47 PM

yes, Problem with asp code Please tell me the example asp with SQL Sever2000
database .Thank you
Nicole
Posted: 05/14/2002, 4:51 AM

Hello,
here is asp code I use to exclude ORDER BY clause from count records sql. Open Classes.asp file and find Property Get RecordsCount(). Then find following code there:

If IsEmpty(CountSQL) Then _
CountSQL = "SELECT Count(*) FROM (" & builtSQL & ") cnt"

It requires some modification. Replace it with:
If IsEmpty(CountSQL) Then _
Dim order_pos
order_pos = InStr(builtSQL, "ORDER BY")
builtSQL = mid(builtSQL, 1, order_pos-1)
CountSQL = "SELECT Count(*) FROM (" & builtSQL & ") cnt"

Good luck
nong
Posted: 05/14/2002, 5:58 AM

thank you very much , i will test for your code
nong
Posted: 05/14/2002, 8:21 PM

i try to use your code , when it sort ,program is ok
but when i try to search ,it still error

Error Type:
Microsoft VBScript runtime (0x800A0005)
Invalid procedure call or argument: 'mid'
/np3/Classes.asp, line 1409

thank you... Please help me
guest
Posted: 05/15/2002, 4:42 AM


Please refer to following MS article to find what could cause this error:
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q181102
Darren
Posted: 05/16/2002, 11:03 AM

This error is being caused by the count SQL statement being constructed when an ORDER BY wasn't used (ie is not present) - such as when you have sortable columns on your grid but no initial sort order set. It is easily fixed by checking that ORDER BY existed before trying to remove it. See below.

If IsEmpty(CountSQL) Then _
Dim order_pos
order_pos = InStr(builtSQL, "ORDER BY")
If order_pos <> 0 Then
builtSQL = mid(builtSQL, 1, order_pos-1)
End If
CountSQL = "SELECT Count(*) FROM (" & builtSQL & ") cnt"
Nong
Posted: 05/16/2002, 6:32 PM

I can solve the problem thank you every body....

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.