Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reset position

Status
Not open for further replies.

malonep

Programmer
Jul 14, 2004
44
CA
Hi,

I am currently trying to convert from a vfp database to a sql-database

I am trying to return a recordset which I can pass through multiple times and build tables off of.

I am need to be able to reset the recordset to the beginning and scan through it a second time.


I set the recordset to be dyanamic and it works but after I return the recordset it results in a adOpenForwardOnly recordset.

How do I stop this from happening?
Code:
rs.CursorType=adOpenDynamic
Response.Write("<BR>" & rs.CursorType)
set rs = cmd.Execute
rs.CursorType=adOpenDynamic
Response.Write("<BR>and after " & rs.CursorType)
 
Perhaps you can try opening your recordset with the .open method...

Code:
set rs = Server.CreateObject("ADODB.Recordset")
rs.open strSQL, connection, 2, 2

I'm not sure how SET works in ASP but upon brief reading on Set rs = connection.execute(sql)... it returns a forward only recordset.

Does anyone know if you can change the curser on a recordset after its been opened?

Earnie Eng
 
How you poen your recordsset is, as ahmun pointed out, very important. No matwer wt you set the cursr to beforehand, if you use a Connection.Execute/Command.Execute to 'open' your recordset then your going to lose those settings. The reason for this is because the Execute method executes a command/sql query/qhat-have-you and then takes the return information and builds it into a Recordset. Without having a Recordset as an argument to the function there is no way for it to guess that you have one prepared already. So what it does is returns a new recordset with the resulting info in it. At this point if you had set a variable to the Executemethod the variable-s reference is changed to point at this newly created recordset, regardless of what it may have been pointing to before.
So if you had created a recordset peviously and only set the one variable pointing to it, it is now gone (as are all your settings that you applied to it)

-T

barcode_1.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top