本文描述了如何利用visual c#.net 创建一个dts 自定义的任务。你可以通过c#.net创建自定义的任务的方式扩展dts的功能。之后你可以安装并注册任务,他讲出现在dts设计其中,就像默认的dts任务。总之,你能够使用.net framework创建自定义的任务。
为dtsspkg.dll创建一个及时的包
如果一个基于微软.net客户机访问一个com组件,你必须使用一个包(这个组件包含的)。这类的包是及时的运行包(rcw)并且你也可以通过开放dtspkg.dll的类型库编译。你也可以使用类型库导出工具(tlbimp.exe)编译rcw,如:
tlbimp.exe “c:\programfiles\microsoft sqlserver\80\tools\binn\dtspkg.dll”/out:microsoft.sqlservver.dtspkg80.dll/keyfile:dtspkg.snk
“/keyfile”参数代表microsoft.sqlserver.dtspkg80.dll带有强类型名用public或private关键字。使用强类型名工具(sn.exe)在dtspkg.snk 前创建关键字:
sn.exe –k dtspkg.snk
你应该使用一个强类型名像其他的全局集合缓存,因为你安装了运行包。
在全局集合缓存中安装运行包
用全局集合缓存工具(gacutil.exe)安装运行包:
| [guid("a39847f3-5845-4459-a25e-de73a8e3cd48"), comvisible(true)] [progid("dts.simpletask")] public class simpletask : customtask { //implementation of custom task } |
| [system.runtime.interopservices.comregisterfunctionattribute()] static void registerserver(type t) { //code to register custom task } |
| [system.runtime.interopservices.comunregisterfunctionattribute()] static void unregisterserver(type t) { //code to unregister custom task } |
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器