Twinsen
|
| Posted: 01/04/2005, 8:34 AM |
|
Hello,
I was searching on the ASP forum awhile ago and found Sylvan Computing's scclasses.asp which lets you export results in a CCS grid object to CSV or Excel.
I implemented this by executing a SQL statement using DBConnection. I now want to export the entire grid object (including any sorts and filters the user might have done).
To do this, I have to pass Grid.Recordset to a function in scclasses.asp.
Here is the code (very little has changed from the sample given at http://www.sylvancomputing.com/ccs/)
If Request.Form("cmdExportCSV") <> "" Then
Dim x
Set x = New clsExportCSV
With x
.ExportGridRecords vu_XYZ.Recordset
End With
Set x = Nothing
End If
The error message is:
Object required: 'xobjRS'
/scclasses.asp, line 159
And I've tried to encapsulate the grid's recordset in other obj variables to pass on to the function but nothing seems to latch on to the grid (vu_XYZ)'s recordset.
This is probably very elementary so I apologize if it's some basic ASP stuff I'm not getting.
Twinsen.
|
|
|
 |
smalloy
Posts: 107
|
| Posted: 01/04/2005, 9:40 AM |
|
Just from what you wrote it looks like you neeed to instantiate the recordset, you may be missing:
Dim objrs
set objrs = Server.CreateObject("adodb.connection")
Make sure all of the database connections are there too, ie
objconn.Open "Driver={Microsoft Access Driver (*,mdb)}; " & connpath
set objrs=objconn.execute("Select * from emplyees")
I have a different version of this script if you want to try mine. Also, search this forum for a much easier way to do it using codecharge and 2 lines of code. The downside is you need to create another page with just the grid.
Good luck
_________________
Anything can be done, just give me time and money. |
 |
 |
twinsen
|
| Posted: 01/05/2005, 5:43 AM |
|
Thank you for your help.
I know scclasses.asp is a bit overkill. But I like the method because it allows the person to sort and manipulate the grid with some filters before exporting.
I know I could probably hardcode a few SQL statements in there but I guess I have a conscience in thinking that someone should be able to maintain it only with the code generator parts of Codecharge.
|
|
|
 |
|