I have a stored procedure on a SQL server 2005 database. Application
accessing it is a VB6 program. The app returns the records fine. What
I would llike to do is after the recordset gets returned is to resort
it to one of the columns returned. Data is currently being sorted from
stored procedure by order date. It being a stored procedure, that is
being used by several different apps, I can't change it on server.
I have defined recordset CursorLocationto be adUseClient
This is the two lines setting recordset (in this case rsNotPicked)
rsNotPicked.CursorLocation = adUseClient
rsNotPicked.Open m_cmdQuery, , adOpenStatic, adLockReadOnly
'EXECUTES the stored procedure
At this point I can step through records with
Do While Not rsNotPicked.EOF
MsgBox rsNotPicked.Fields("item Description")
rsNotPicked.MoveNext
Loop
The message box is the field I would like to resort by
when I try to execute
rsNotPicked.Sort = "item description ASC"
I get error Run-Time 3001
Arguments are of the wrong type, are out of range,or are in conflict
with one another.
I can use the sort method with simple select statements, but using the
stored procedure recordset I am struggling with.
ANy help would be most appreciated.
Richard Mueller [MVP] - 28 Jan 2008 16:35 GMT
>I have a stored procedure on a SQL server 2005 database. Application
> accessing it is a VB6 program. The app returns the records fine. What
[quoted text clipped - 27 lines]
>
> ANy help would be most appreciated.
I wonder if the space in the field name confuses things. I would try:
rsNotPicked.Sort = "[item description] ASC"

Signature
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--
sanmagoo@excite.com - 28 Jan 2008 17:02 GMT
On Jan 28, 11:35 am, "Richard Mueller [MVP]" <rlmueller-
nos...@ameritech.nospam.net> wrote:
> <sanma...@excite.com> wrote in message
>
[quoted text clipped - 43 lines]
>
> - Show quoted text -
Thank you. That did it and I am sooooooo damn grateful.
Richard Mueller [MVP] - 28 Jan 2008 18:35 GMT
On Jan 28, 11:35 am, "Richard Mueller [MVP]" <rlmueller-
nos...@ameritech.nospam.net> wrote:
> <sanma...@excite.com> wrote in message
>
[quoted text clipped - 43 lines]
>
> - Show quoted text -
Thank you. That did it and I am sooooooo damn grateful.
------------------
The square brackets can also be required if the field name is a reserved
word, like [user].

Signature
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--