Microsoft KB Archive/248502

From BetaArchive Wiki
Knowledge Base

BUG: setRecordSource() Fails When Passed a Connection String and SQL Statement

Article ID: 248502

Article Last Modified on 10/16/2002


  • Microsoft Visual InterDev 6.0 Standard Edition

This article was previously published under Q248502


When your code calls the setRecordSource() method of the Visual InterDev 6.0 Recordset design-time control (DTC) and passes to it a valid connection string and SQL statement, the changes do not take effect. Here is an example:

RSDTC.setRecordSource "DRIVER=SQL Server;SERVER=Server1;UID=sa;DATABASE=Pubs", "Select * from authors"


This fails because of a bug in the script library for the Recordset DTC (Recordset.asp).


To resolve the problem, replace the single setRecordSource() call with two calls: one to getRecordSource(), in which you set the ActiveCommand.ActiveConnection property of the underlying ADO Recordset, and a second call, to setSQLText(), in which you set the source SQL statement. For example, replace

RSDTC.setRecordSource strConnectionString, strSQL


RSDTC.getRecordSource().ActiveCommand.ActiveConnection = strConnectionString
RSDTC.setSQLText strSQL 


Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

Keywords: kbbug KB248502