?
Solved

Hwo to create a dynamic recordset?

Posted on 2003-02-18
11
Medium Priority
?
876 Views
Last Modified: 2012-06-21
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!

0
Comment
Question by:winnydapoo
  • 4
  • 3
  • 2
  • +2
11 Comments
 

Author Comment

by:winnydapoo
ID: 7978827
Note I also want dynamic so I can update the recordset, forgot to mention...
0
 

Author Comment

by:winnydapoo
ID: 7978901
Note I also want dynamic so I can update the recordset, forgot to mention...
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 7978943
Try this instead:

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

Fritz the Blank
0
Technology Partners: 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!

 
LVL 15

Expert Comment

by:gladxml
ID: 7979029
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...
0
 
LVL 4

Expert Comment

by:Wakie
ID: 7979869
winnydapoo,

What does your SQL query look like?
0
 
LVL 5

Expert Comment

by:dgorin
ID: 7979933
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.
0
 

Author Comment

by:winnydapoo
ID: 7980579
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?
0
 
LVL 4

Expert Comment

by:Wakie
ID: 7990220
Where is your SQL?
0
 
LVL 46

Accepted Solution

by:
fritz_the_blank earned 400 total points
ID: 7990392
Okay, then try this--it is a little more resource heavy:

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


Fritz the Blank
0
 

Author Comment

by:winnydapoo
ID: 9471754
Sorry for the delay guys, appreciate all the help!
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 9477124
Glad to have helped,

Fritz the Blank
0

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

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

579 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