Visual InterDev
Sets the connection properties for opening a Recordset object.
Syntax
object.setRecordSource(rsADO | strConn, strSQL)
Parameters
object
A script object.
rsADO
An ADO recordset.
strConn
Specifies the data connection.
strSQL
Specifies the SQL statement.
Remarks
This method resets all the properties of the Recordset script object.
When using the getRecordSource method your are getting the underlying ADO Recordset Object, not a clone. If you make adjustments to the object, you will need to synchronize it back to the Recordset script object using setRecordSource.
Examples
The following script assumes that there are two Recordset design-time controls on the page, RS1 and RS2. When the clone button is pressed, RS2 becomes a clone of RS1 using the setRecordSource and getRecordSource methods.
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
function btnClone_onclick()
{
RS2.setRecordSource(RS1.getRecordSource());
}
</SCRIPT>
In the following sample script, the function initializes a recordset based on a connection string (strconn). When the Init button is pressed, Recordset script object, RS2, becomes initialized with the contents of the Authors table from the Pubs database on Server1.
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
function btnInit_onclick()
{
RS2.setRecordSource('DRIVER=SQL Server;SERVER=Server1;User ID=sa;PASSWORD=;DATABASE=Pubs', 'Select * from authors');
}
</SCRIPT>
In this third example, suppose you have a Visual Basic® ActiveX® DLL that returns a recordset. You can assign that recordset to the Recordset script object.
sub myRs_onbeforeopen()
dim myObj
set myObj = Server.CreateObject("MyBusinessObject.MyClass")
myRs.setRecordSource(myobj.myRecordsetReturningFunction)
end Sub