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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pass a recordset from middleware to a grid?

Status
Not open for further replies.

TimOSullivan

Programmer
Mar 9, 2001
13
0
0
IE
Hi,
Is it possible to pass a recordset optained from a MTS com object to a grid dtc?
I've been trying to do this without using the recordset dtc or any data environments.
I've no problems with getting the recordset to the asp and can populate listbox dtcs OK.
However, the grid dtc seems to need the recordset dtc which, in turn, seems to need a data environment.
Or, am I missing the point on something here?

Thanks,
Tim
 
It is possible, though not very obvious.
Create a recordset DTC with similar choices to the ones you want - and base ant grids etc on this. Now convert the RecordsetDTC to Text, and then you can 'play' with it!

You will need to alter the _init<recordetDTC> function to pick up the recordset that you have obtained from COM. The reason that the _init function is separated from the creation function (_<recordsetDTC>_ctor()) is that all DTC objects are created using the _ctor() methods, then populated later using the _init methods - thus one object can refer to any another within the _init method.

In this example I have saved a recordset as a Session variable, which is used by 'rsResults' recordsetDTC:

<!--#INCLUDE FILE=&quot;_ScriptLibrary/Recordset.ASP&quot;-->
<script LANGUAGE=&quot;JavaScript&quot; RUNAT=&quot;server&quot;>
function _initrsResults()
{
@if (@trace == true)
Response.Write (&quot;<br> _initrsResults&quot;);
@end
var x = Session(&quot;Recordset&quot;); //** create your COM object here instead!!!
if ( typeof x == &quot;object&quot; && Session(&quot;RecordsetOK&quot;) == &quot;Y&quot; ) {
rsResults.setRecordSource(x);
}
if (thisPage.getState('pb_rsResults') != null)
rsResults.setBookmark(thisPage.getState('pb_rsResults'));
}
..etc..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top