Link to home
Start Free TrialLog in
Avatar of winnydapoo
winnydapoo

asked on

Hwo to create a dynamic recordset?

I need a dynamic recordset (it has to be able to move backwards and forwards). Its contents should come from running a stored procedure on the sql server called "getcust". It should be based on a connection that does not use a DSN. I tried a bunch of examples on the net but I seem to get alot of errors. Can anyone show me a snippet that accomplishes what I need? at the moment I have :

conn.Open "Provider=SQLOLEDB; Data Source = nt1; Initial Catalog = sabre_cust; User Id = sa; Password="

If conn.errors.count = 0 Then
     set rs = conn.execute("getcust")
end if

however, it is not dynamic so it can only move forward not backward. Any help greatly aprpeciated, its driving me nuts!

Avatar of winnydapoo
winnydapoo

ASKER

Note I also want dynamic so I can update the recordset, forgot to mention...
Note I also want dynamic so I can update the recordset, forgot to mention...
Avatar of fritz_the_blank
Try this instead:

set objRS=Server.CreateObject("ADODB.RecordSet")
objRS.Open "getcust",conn,3,3

Fritz the Blank
winnydapoo,

YOU CAN TRY TO CHECK THIS OUT... MIGHT HELP...

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdmthmovefirstvbscriptx.asp

BTW I ALREADY TEST THE CODE BY CHANGING THE VALUES BASE ON MY EXISITNG DB...

HAPPY PROGRAMMING...
winnydapoo,

What does your SQL query look like?
You'll have to use the technique fritz the blank showed, or an ado command object.  A conn.execute() of a sql statement returns a forward-only read-only recordset.
when I execute a rs.movelast using Frink's code, I get this error :

Error Type:
Microsoft OLE DB Provider for SQL Server (0x80040E24)
Rowset does not support fetching backward.

And if I try to execute a rs.moveprevious I get this error :

Error Type:
ADODB.Recordset (0x800A0C93)
Operation is not allowed in this context.
/demo.asp, line 49

What am I doing wrong?
Where is your SQL?
ASKER CERTIFIED SOLUTION
Avatar of fritz_the_blank
fritz_the_blank
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sorry for the delay guys, appreciate all the help!
Glad to have helped,

Fritz the Blank