Home > Archive > ASP .NET > August 2007 > How to call C# dll from sql server 2000 dts?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to call C# dll from sql server 2000 dts?
|
|
| ronc85@gmail.com 2007-08-15, 10:18 pm |
| Using SQL Server 2000, Visual Studio 2005, .NET 2.0 and C#.
>From a SQL Server 2000 DTS package is it possible to call a C# dll
passing one parameter and having two parameters returned?
Thanks,
Sal
| |
| Cowboy \(Gregory A. Beamer\) 2007-08-16, 4:38 am |
| You can NEVER return two parameters. You can return XML, or similar, and
parse. Or you can pass one parameter by reference and alter it, but your
return type is always singular.
Having said that ... there are some possibilities here. The issue here is
getting DTS to talk to anything, as it likes scripting. Move up to SSIS
(2005) and some of the problem goes away.
But, it is possible to hit COM. And, that means if you COM wrap .NET
components you can use them. Have never tried, so there is no way I can give
you a step by step. With SQL 2000, you can export the package to VB and then
call the COM wrapper from there, so I know that is possible, but it is also
a pain to do if you move the package out to VB too early, as editing DTS in
COM is painful (did it once .... once).
--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA
****************************************
*********
| Think outside the box! |
****************************************
*********
<ronc85@gmail.com> wrote in message
news:1187228146.812878.183030@i13g2000prf.googlegroups.com...
> Using SQL Server 2000, Visual Studio 2005, .NET 2.0 and C#.
>
> passing one parameter and having two parameters returned?
>
> Thanks,
> Sal
>
| |
| ronc85@gmail.com 2007-08-16, 4:38 am |
| Unfortunately switching to 2005 is not possible at this time.
Returning one parameter would work. I just haven't seen an example of
how to create a COM object with .NET 2.0 that is accessible with DTS
or an extended stored procedure.
Thanks,
Sal
| |
|
| > I just haven't seen an example of
> how to create a COM object with .NET 2.0 that is accessible with DTS
> or an extended stored procedure.
It's outside the scope of this group, but google .net and com and you'll
find loads of examples on the net. It's very simple, just create a normal
class with an interface and fixed guid, compile it and use the command line
tool "regasm" to create and register a COM wrapper for you. You can now
call it via your DTS script using;
set obj = CreateObject("MyProject.MyClass")
obj.MyMethod ()
Quick search on "exposing .net class com" found this
http://www.codeproject.com/dotnet/nettocom.asp
| |
| Sergey Poberezovskiy 2007-08-16, 10:15 pm |
| One way would be to COM enable your C# dll, register it on the same box where
your SQL Server runs - then you should be able to use it the same way as any
other COM objects inside ActiveX scripting task
"ronc85@gmail.com" wrote:
> Using SQL Server 2000, Visual Studio 2005, .NET 2.0 and C#.
>
> passing one parameter and having two parameters returned?
>
> Thanks,
> Sal
>
>
| |
| ronc85@gmail.com 2007-08-16, 10:15 pm |
| Thanks. I forgot this was the ASP.NET forum. Most of my time is with
ASP.NET/AJAX.
|
|
|
|
|