Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server ASP
|
SQL Server ASP Discussions about ASP programming with Microsoft's SQL Server. For more ASP forums, see the ASP forum category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server ASP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 14th, 2004, 03:10 PM
Authorized User
 
Join Date: Sep 2004
Posts: 70
Thanks: 0
Thanked 0 Times in 0 Posts
Default CopyFromRecordset to Spreadsheet

Hi, all,

I am trying to load a spreadsheet (OWC) on my ASP page directly from the RecordSet.

However, since the returned recordset can be huge, I will only load the spreadsheet with first 1000 rows, if users choose to see the next 1000 rows, I will load the next 1000 rows - pretty much treating the spreadsheet as a list box but with Excel functions.

I do by something like this:
    
Code:
rs.CursorLocation = 3 'adUseClient
Code:
    rs.CursorType = 1 'adOpenKeyset
    rs.LockType = 3 'adLockOptimistic
    rs.PageSize = 1000
    rs.Open sSQL, Cnn
    SS1.ActiveSheet.Cells.copyFromRecordset rs,1000
     And this has been successful. But when I try to load the next 1000 rows, it still displays the first 1000 rows. I do this by:
    
Code:
rs.AbsolutePage = 2
Code:
        SS1.ActiveSheet.UsedRange.ClearContents 
        SS1.ActiveSheet.Cells.copyFromRecordset rs,1000

I check the recordset before the "copyFromRecordset" method, and the recordset is at the correct position. But the "copyFromRecordset" seems to ignore it, and load the spreadsheet from the BOF of the recordset.
Anyone knows about this? Thanks.

 
Old October 14th, 2004, 03:46 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

No idea; you try the rs.Move method?

Brian
 
Old October 14th, 2004, 03:56 PM
Authorized User
 
Join Date: Sep 2004
Posts: 70
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I used rs.Move, and I checked the results, and it shows the right data, but when I go on to use CopyFromRecordset, it STILL loads and shows the first 1000 rows. =(






Similar Threads
Thread Thread Starter Forum Replies Last Post
runtime error when copyfromrecordset wuy Excel VBA 0 October 11th, 2007 09:16 PM
CopyFromRecordset Error maaron SQL Server ASP 1 April 17th, 2007 10:26 AM
Copyfromrecordset error using ADO maaron Excel VBA 0 August 11th, 2006 08:52 AM
VBA CopyFromRecordset and Excel JWag Pro VB Databases 0 April 12th, 2005 09:03 AM
CopyFromRecordset and ADO.NextRecord chrislepingwell Excel VBA 3 March 28th, 2005 11:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.