Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


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

Posted on 2004-10-28
Medium Priority
Last Modified: 2012-06-27
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

      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.
Question by:nthilak
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 12431963
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

Accepted Solution

kGenius earned 375 total points
ID: 12435864

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

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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question