Using ASP and Sql Server Storedprocedure. not abel to MoveFirst in Recordset.

     
Hi Members,

I am using Sql Server 2000.
i am not abel to movelast and movefirst in the Recordset.

The Stroedprocedure.
CREATE PROCEDURE [veenaimvsql].[AllFlashCards] AS
select ecid,smallcard,Hits from ecards where flash='True' order by ecid desc
GO


      Set objCmdECards=Server.CreateObject("adodb.command")
      objCmdECards.ActiveConnection = stringConn
      objCmdECards.CommandText = "FlashCards"
      objCmdECards.CommandType = adCmdStoredProc

      ObjRsFlashCards.Open objCmdECards.Execute
      Set objCmdECards = Nothing

If i give ObjRsFlashCards.Movefirst

Operation was canceled. - is the Error result in that line.

i am not abel to get the recordcount also if i use like this.
Recordcount Returns -1.

how can i do movefirst and get the Recordcount value.

Thank you.
nthilakAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rlibrandiCommented:
You need to use client-side cursor to get recordcount.  Also, remember, movefirst, movenext, etc are RECORDSET operations.

Try this

Set rsECards = Server.CreateObject("ADODB.RecordSet")
rsEcards.CursorLocation = adUseClient
rsECards.Open "FlashCards", stringConn, 3,3
0
kGeniusCommented:
Hi,

probably you should some articles about CursorLocation and CursorType (members of a recordset object)
Default the CursorType of a recordset is adOpenForwardOnly. Then you'll understand that moving to the first record is impossible. Also a RecordCount is not possible with this cursortype.

you're code may look like:
Set objCmdECards=Server.CreateObject("adodb.command")
     objCmdECards.ActiveConnection = stringConn
     objCmdECards.CommandText = "FlashCards"
     objCmdECards.CommandType = adCmdStoredProc

     Set ObjRsFlashCards = Server.CreateObject("adodb.Recordset")
     ObjRsFlashCards.CursorLocation = adUseClient
     ObjRsFlashCards.CursorType  = adOpenStatic
     ObjRsFlashCards.Open objCmdECards.Execute
     Set objCmdECards = Nothing

ObjRsFlashCards.Movefirst
In this example the adOpenStatic lets you move through the recordset forward and backwards...

To understand more about these cursor-things you should read http://www.adopenstatic.com/faq/jetcursortypes.asp

Hope we have helped
kGenius
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.