|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Importing DLLs during runtimeI'm currently developing an application for checking and doing some configurations for another application. During those checks, I have to access SQLServer to get configuration-info like MaxServerMemory, MaxDegreeOfParallelism, etc I added the references for - Microsoft.SqlServer.ConnectionInfo and - Microsoft.SqlServer.Smo to my project and then imported the namespaces - Microsoft.SqlServer.Management.Smo and - Microsoft.SqlServer.Management.Common and used their classes 'Server' and 'ServerConnection' to do the job Everythink works fine, but the problem is, that the DLLs - Microsoft.SqlServer.Replication and - Microsoft.SqlServer.BatchParser are now needed (and added to my project) This wouldn't be a problem, but I wondered what happens when SQLServer is not installed and the DLLs are missing. Long story short: I want to get rid of the imports and do some kind of DLL-Late-Binding, so I can react to missing DLLs within my program. I tried to use the 'DLLImport' but I don't know much about that...So can anyone tell me how to get the 2 classes I need (Server, ServerConnection)? P.S.: I'm a newbie, so keep your answers (and perhaps examples) as simple as possible ;-) > I tried to use the 'DLLImport' but I don't know much about that...
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcn7/html/vaconCallingWindowsAPIs.asp
Thanks, Seth Rowe normanch***@freenet.de wrote: Show quoteHide quote > Hi, > > I'm currently developing an application for checking and doing some > configurations for another application. During those checks, I have to > access SQLServer to get configuration-info like MaxServerMemory, > MaxDegreeOfParallelism, etc > > I added the references for > - Microsoft.SqlServer.ConnectionInfo and > - Microsoft.SqlServer.Smo > to my project and then imported the namespaces > - Microsoft.SqlServer.Management.Smo and > - Microsoft.SqlServer.Management.Common > and used their classes 'Server' and 'ServerConnection' to do the job > > Everythink works fine, but the problem is, that the DLLs > - Microsoft.SqlServer.Replication and > - Microsoft.SqlServer.BatchParser > are now needed (and added to my project) > > This wouldn't be a problem, but I wondered what happens when SQLServer > is not installed and the DLLs are missing. > Long story short: I want to get rid of the imports and do some kind of > DLL-Late-Binding, so I can react to missing DLLs within my program. > I tried to use the 'DLLImport' but I don't know much about that...So > can anyone tell me how to get the 2 classes I need (Server, > ServerConnection)? > > P.S.: I'm a newbie, so keep your answers (and perhaps examples) as > simple as possible ;-) On 5 Oct 2006 01:02:31 -0700, normanch***@freenet.de wrote:
First off, DllImport Will Fail, those two files are .NET assemblies - not Win32 DLLs. Second off, use the imports. The app will toss an exception if the required DLLs are missing and you can then correct the problem. -Boo Show quoteHide quote >Hi, > >I'm currently developing an application for checking and doing some >configurations for another application. During those checks, I have to >access SQLServer to get configuration-info like MaxServerMemory, >MaxDegreeOfParallelism, etc > >I added the references for >- Microsoft.SqlServer.ConnectionInfo and >- Microsoft.SqlServer.Smo >to my project and then imported the namespaces >- Microsoft.SqlServer.Management.Smo and >- Microsoft.SqlServer.Management.Common >and used their classes 'Server' and 'ServerConnection' to do the job > >Everythink works fine, but the problem is, that the DLLs >- Microsoft.SqlServer.Replication and >- Microsoft.SqlServer.BatchParser >are now needed (and added to my project) > >This wouldn't be a problem, but I wondered what happens when SQLServer >is not installed and the DLLs are missing. >Long story short: I want to get rid of the imports and do some kind of >DLL-Late-Binding, so I can react to missing DLLs within my program. >I tried to use the 'DLLImport' but I don't know much about that...So >can anyone tell me how to get the 2 classes I need (Server, >ServerConnection)? > >P.S.: I'm a newbie, so keep your answers (and perhaps examples) as >simple as possible ;-) GhostInAK schrieb:
> On 5 Oct 2006 01:02:31 -0700, normanch***@freenet.de wrote: That's right - sorry, DllImport = stupid idea (Like I wrote: I'm a> > First off, DllImport Will Fail, those two files are .NET assemblies - > not Win32 DLLs. newbie ;-) ) > Second off, use the imports. The app will toss an exception if the When I start my application without those dlls, a dialog with the> required DLLs are missing and you can then correct the problem. exception-message appears but that doesn't seem to be the best solution...Isn't there a way to bind the assemblies during runtime? I tried to use Reflection.Assembly.load(Microsoft.SqlServer.Replication) but it doesn't seem that I can access the classes 'Server' and 'ServerConnection' with this. So I used Reflection.Assembly.load(Microsoft.SqlServer.Smo) but that threw an exception... I wondered why I need the .Replication.dll \ BatchParser.dll because the two assemblies refer to .Smo.dll \ .ConnectionInfo.dll ?!?
Redim Multidimenional Arrays
MS Word Chart filled with data - URGENT PLEASE VB6 --> VB 2005 upgrade ...IDE now VERY slow!!! using strongly typed dataset update problem Compiling .dll's into a stand-alone .exe Q: GetChildRows Problems with shortcut files FolderBrowserDialag? Can't get the Internet Transfer Control to work Microsoft.VisualBasic.Replace bug |
|||||||||||||||||||||||