Microsoft KB Archive/248502

From BetaArchive Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Knowledge Base


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

Article ID: 248502

Article Last Modified on 10/16/2002



APPLIES TO

  • Microsoft Visual InterDev 6.0 Standard Edition



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.

Keywords: kbbug KB248502