I am trying to create a class library accessible to in SQL server as a
COM. I am using the Wininet.dll and can get it to build successfully. I
then run tlbexp and create the type library and when I attempt to
register the dll with regasm.exe I get the following error:
RegAsm : warning RA0000 : No types were registered
This is my code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Reflection;
using System.IO;
namespace BDS_FTP
{
public class FTP
{
public FTP()
{
//COM requires an empty constructor
}
//DECLARATIONS
[DllImport("wininet.dll")]
public static extern long InternetOpen( string strAppName,
long ulAccessType,
string strProxy,
string strProxyBypass,
long ulFlags);
[DllImport("wininet.dll")]
public static extern long InternetConnect(long ulSession,
string strServer,
int ulPort,
string strUser,
string strPassword,
long ulService,
long ulFlags,
long ulContext);
[DllImport("wininet.dll")]
public static extern bool InternetGetConnectedState(ref uint
ulFlags, uint ulReserved);
[DllImport("wininet.dll")]
public static extern bool FtpSetCurrentDirectory(IntPtr
ulSession, string strPath);
[DllImport("wininet.dll")]
public static extern bool FtpGetFile(IntPtr ulSession, string
strRemoteFile, string strLocalFile, bool bolFailIfExist, ulong ulFlags,
ulong ulInetFals, ulong ulContext);
}
}
Any advice or help would be greatly appreiciated!
Thanks!
Todd S
Johannes Passing - 07 Nov 2005 14:45 GMT
Hi,
you have to declare your types as [ComVisible(true)].
However, you should have a look at
http://support.microsoft.com/kb/q238425/
first - wininet does not support being used from within a service.
Do you really want your SQL server to use FTP?
/Johannes
> I am trying to create a class library accessible to in SQL server as a
> COM. I am using the Wininet.dll and can get it to build successfully. I
[quoted text clipped - 61 lines]
> Thanks!
> Todd S