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



The information in this article applies to:

  • Microsoft Visual InterDev 6.0

This article was previously published under Q248502

SYMPTOMS

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"
				

CAUSE

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

RESOLUTION

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
				
with:
RSDTC.getRecordSource().ActiveCommand.ActiveConnection = strConnectionString
RSDTC.setSQLText strSQL 
				

STATUS

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

Modification Type:MajorLast Reviewed:10/16/2002
Keywords:kbBug kbDSupport KB248502