|
 |
asp_web_howto thread: Sort Problem
Message #1 by =?iso-8859-1?q?sky=20limit?= <skylimit7772002@y...> on Tue, 15 Oct 2002 11:07:49 +0100 (BST)
|
|
Hi Guys
My question is I simply doing a sort on column getting an error. I can't understand what this error is.
Here is my code..............
<% Option Explicit %>
<%
Const adCmdTableDirect = &H0200
Const adLockReadOnly = 1
Const adOpenStatic = 1
Const adUseClient = 3
Dim DetailConn, SQLrs, sMsg, bDone, bError,sql
Set DetailConn = Server.CreateObject("ADODB.Connection")
DetailConn.Open Application("blazeconnection")
Set SQLrs = Server.CreateObject("ADODB.Recordset")
sql = "SELECT * from Users"
SQLrs.CursorLocation = adUseClient
'Set SQLrs = DetailConn.Execute("SELECT * from Users ")
SQLrs.Open "Users",DetailConn,adOpenStatic,adLockReadOnly,adCmdTableDirect
'result without sorting which works fine
Do until SQLrs.EOF
Response.write SQLrs("uname") & "<br>"
SQLrs.MoveNext
Loop
'result with sorting gives error
SQLrs.movefirst
SQLrs.Sort("uname") // this is where i am doing sorting
while not SQLrs.EOF
Response.write SQLrs("uname") & "<br>"
SQLrs.MoveNext
wend
%>
Error Type:
Microsoft VBScript runtime (0x800A01C2)
Wrong number of arguments or invalid property assignment: 'Sort'
/test/connts.asp, line 26
I know we can sort with order by clause. But I wanted to use the sort method.
Any Help is really appreciated.
Regards
" SQLrs.MoveNext Loop SQLrs.movefirst SQLrs.Sort("uname") while not SQLrs.EOF Response.write SQLrs("uname") & "
" SQLrs.MoveNext wend %>" SQLrs.MoveNext Loop SQLrs.movefirst SQLrs.Sort("uname") while not
SQLrs.EOF Response.write SQLrs("uname") & "
" SQLrs.MoveNext wend %>" SQLrs.MoveNext Loop SQLrs.movefirst SQLrs.Sort("uname") while not
SQLrs.EOF Response.write SQLrs("uname") & "
" SQLrs.MoveNext wend %>
---------------------------------
Get a bigger mailbox -- choose a size that fits your needs.
Message #2 by "Imar Spaanjaars" <Imar@S...> on Tue, 15 Oct 2002 12:40:36 +0200 (CEST)
|
|
Hi there,
Check out the ADO docs at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdprosortpropertyado.asp
Sort is not a method, but a property, so something like this should work:
SQLrs.Sort = "uname ASC"
HtH
Imar
>
> Hi Guys
>
> My question is I simply doing a sort on column getting an error. I
> can't understand what this error is.
>
> Here is my code..............
>
> <% Option Explicit %>
> <%
> Const adCmdTableDirect = &H0200
> Const adLockReadOnly = 1
> Const adOpenStatic = 1
> Const adUseClient = 3
>
>
> Dim DetailConn, SQLrs, sMsg, bDone, bError,sql
>
>
> Set DetailConn = Server.CreateObject("ADODB.Connection")
> DetailConn.Open Application("blazeconnection")
>
> Set SQLrs = Server.CreateObject("ADODB.Recordset")
> sql = "SELECT * from Users"
> SQLrs.CursorLocation = adUseClient
> 'Set SQLrs = DetailConn.Execute("SELECT * from Users ")
> SQLrs.Open
> "Users",DetailConn,adOpenStatic,adLockReadOnly,adCmdTableDirect
>
>
> 'result without sorting which works fine
> Do until SQLrs.EOF
> Response.write SQLrs("uname") & "<br>"
> SQLrs.MoveNext
> Loop
>
> 'result with sorting gives error
>
> SQLrs.movefirst
> SQLrs.Sort("uname") // this is where i am doing sorting
> while not SQLrs.EOF
> Response.write SQLrs("uname") & "<br>"
> SQLrs.MoveNext
> wend
>
> %>
>
> Error Type:
> Microsoft VBScript runtime (0x800A01C2)
> Wrong number of arguments or invalid property assignment: 'Sort'
> /test/connts.asp, line 26
>
> I know we can sort with order by clause. But I wanted to use the sort
> method.
>
>
>
> Any Help is really appreciated.
>
> Regards
>
>
>
> " SQLrs.MoveNext Loop SQLrs.movefirst SQLrs.Sort("uname") while
> not SQLrs.EOF Response.write SQLrs("uname") & " " SQLrs.MoveNext wend
> %>" SQLrs.MoveNext Loop SQLrs.movefirst SQLrs.Sort("uname")
> while not SQLrs.EOF Response.write SQLrs("uname") & "
> " SQLrs.MoveNext wend %>"
> SQLrs.MoveNext Loop SQLrs.movefirst SQLrs.Sort("uname") while not
> SQLrs.EOF Response.write SQLrs("uname") & " " SQLrs.MoveNext wend
> %>
>
Message #3 by =?iso-8859-1?q?sky=20limit?= <skylimit7772002@y...> on Tue, 15 Oct 2002 12:01:40 +0100 (BST)
|
|
Thanks Imar
You are right , it's not a method but a property.
Thanks again
Imar Spaanjaars <Imar@S...> wrote:Hi there,
Check out the ADO docs at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdprosortpropertyado.asp
Sort is not a method, but a property, so something like this should work:
SQLrs.Sort = "uname ASC"
HtH
Imar
>
> Hi Guys
>
> My question is I simply doing a sort on column getting an error. I
> can't understand what this error is.
>
> Here is my code..............
>
>
> > Const adCmdTableDirect = &H0200
> Const adLockReadOnly = 1
> Const adOpenStatic = 1
> Const adUseClient = 3
>
>
> Dim DetailConn, SQLrs, sMsg, bDone, bError,sql
>
>
> Set DetailConn = Server.CreateObject("ADODB.Connection")
> DetailConn.Open Application("blazeconnection")
>
> Set SQLrs = Server.CreateObject("ADODB.Recordset")
> sql = "SELECT * from Users"
> SQLrs.CursorLocation = adUseClient
> 'Set SQLrs = DetailConn.Execute("SELECT * from Users ")
> SQLrs.Open
> "Users",DetailConn,adOpenStatic,adLockReadOnly,adCmdTableDirect
>
>
> 'result without sorting which works fine
> Do until SQLrs.EOF
> Response.write SQLrs("uname") & "
"
> SQLrs.MoveNext
> Loop
>
> 'result with sorting gives error
>
> SQLrs.movefirst
> SQLrs.Sort("uname") // this is where i am doing sorting
> while not SQLrs.EOF
> Response.write SQLrs("uname") & "
"
> SQLrs.MoveNext
> wend
>
> %>
>
> Error Type:
> Microsoft VBScript runtime (0x800A01C2)
> Wrong number of arguments or invalid property assignment: 'Sort'
> /test/connts.asp, line 26
>
> I know we can sort with order by clause. But I wanted to use the sort
> method.
>
>
>
> Any Help is really appreciated.
>
> Regards
>
>
>
> " SQLrs.MoveNext Loop SQLrs.movefirst SQLrs.Sort("uname") while
> not SQLrs.EOF Response.write SQLrs("uname") & " " SQLrs.MoveNext wend
> %>" SQLrs.MoveNext Loop SQLrs.movefirst SQLrs.Sort("uname")
> while not SQLrs.EOF Response.write SQLrs("uname") & "
> " SQLrs.MoveNext wend %>"
> SQLrs.MoveNext Loop SQLrs.movefirst SQLrs.Sort("uname") while not
> SQLrs.EOF Response.write SQLrs("uname") & " " SQLrs.MoveNext wend
> %>
>
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
---------------------------------
Get a bigger mailbox -- choose a size that fits your needs.
|
|
 |