Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / November 2005

Tip: Looking for answers? Try searching our database.

Trying to create a dll accessible from SQL Server (sp_OACreate), here is my code..

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Todd S - 04 Nov 2005 22:26 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.