共用方式為


Requirements for Using Replication ActiveX Controls in Development Environments

更新: 2006 年 4 月 14 日

This section explains how to use the SQL Distribution control, SQL Merge control, and SQL Snapshot control in Microsoft Visual Basic and Microsoft Visual C++ development environments.

ms147347.note(zh-tw,SQL.90).gif重要事項:
The replication ActiveX controls are deprecated in favor of Replication Management Objects (RMO) for programming in managed code. If you call the ActiveX controls from managed code, you must use .NET Framework 2.0 or an exception is thrown.

Microsoft Visual Basic

To use one or more Microsoft ActiveX replication controls in a Visual Basic program: on the Project/References menu in the Visual Basic Development Environment, in the References dialog box, select the .dll references for the controls you plan to use.

Component Reference Library

SQL Distribution Control

Microsoft SQL Distribution Control 9.0

sqldistx.dll

SQL Merge Control

Microsoft SQL Merge Control 9.0

sqlmergx.dll

Replication Errors

Microsoft SQL Replication Errors 9.0

replerrx.dll

For a default installation of SQL Server 2005, these files are located in C:\Program Files\Microsoft SQL Server\90\COM\.

Microsoft Visual C++

To use the one or more replication controls in a Visual C++ program, use the #import directive to import the files from the Libraries column of the following table in the appropriate source files of your project.

Component Libraries

SQL Distribution Control

sqldistx.dll

SQL Merge Control

sqlmergx.dll

Replication Errors

replerrx.dll

Reference these files in your project or NMAKE file. For a default installation of SQL Server 2005, these files are located in C:\Program Files\Microsoft SQL Server\90\COM\.

After the controls are referenced, they can be included in the Components toolbar; however, these controls are not user interface controls. Drawing the controls on the form will not instantiate them. The controls need to be instantiated with the NEW keyword. In addition, a variable of the ActiveX object's class can be declared using the WithEvents keyword. This enables the program to receive callbacks from the agents, and the application can cancel the ActiveX object in this callback function. The callback is also available with the SQLReplError Object, although it is a notify callback and not a status callback.

Change History

Release History

2006 年 4 月 14 日

New content:
  • Added a note about calling replication ActiveX controls from managed code.

請參閱

參考

Replication ActiveX Control Reference

說明及資訊

取得 SQL Server 2005 協助