473,545 Members | 721 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Importing DLLs during runtime

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 ,
MaxDegreeOfPara llelism, etc

I added the references for
- Microsoft.SqlSe rver.Connection Info and
- Microsoft.SqlSe rver.Smo
to my project and then imported the namespaces
- Microsoft.SqlSe rver.Management .Smo and
- Microsoft.SqlSe rver.Management .Common
and used their classes 'Server' and 'ServerConnecti on' to do the job

Everythink works fine, but the problem is, that the DLLs
- Microsoft.SqlSe rver.Replicatio n and
- Microsoft.SqlSe rver.BatchParse r
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,
ServerConnectio n)?

P.S.: I'm a newbie, so keep your answers (and perhaps examples) as
simple as possible ;-)

Oct 5 '06 #1
3 1785
I tried to use the 'DLLImport' but I don't know much about that...

http://msdn.microsoft.com/library/de...indowsAPIs.asp

Thanks,

Seth Rowe

no*********@fre enet.de wrote:
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 ,
MaxDegreeOfPara llelism, etc

I added the references for
- Microsoft.SqlSe rver.Connection Info and
- Microsoft.SqlSe rver.Smo
to my project and then imported the namespaces
- Microsoft.SqlSe rver.Management .Smo and
- Microsoft.SqlSe rver.Management .Common
and used their classes 'Server' and 'ServerConnecti on' to do the job

Everythink works fine, but the problem is, that the DLLs
- Microsoft.SqlSe rver.Replicatio n and
- Microsoft.SqlSe rver.BatchParse r
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,
ServerConnectio n)?

P.S.: I'm a newbie, so keep your answers (and perhaps examples) as
simple as possible ;-)
Oct 5 '06 #2
On 5 Oct 2006 01:02:31 -0700, no*********@fre enet.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
>Hi,

I'm currently developing an application for checking and doing some
configuratio ns for another application. During those checks, I have to
access SQLServer to get configuration-info like MaxServerMemory ,
MaxDegreeOfPar allelism, etc

I added the references for
- Microsoft.SqlSe rver.Connection Info and
- Microsoft.SqlSe rver.Smo
to my project and then imported the namespaces
- Microsoft.SqlSe rver.Management .Smo and
- Microsoft.SqlSe rver.Management .Common
and used their classes 'Server' and 'ServerConnecti on' to do the job

Everythink works fine, but the problem is, that the DLLs
- Microsoft.SqlSe rver.Replicatio n and
- Microsoft.SqlSe rver.BatchParse r
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,
ServerConnecti on)?

P.S.: I'm a newbie, so keep your answers (and perhaps examples) as
simple as possible ;-)
Oct 5 '06 #3

GhostInAK schrieb:
On 5 Oct 2006 01:02:31 -0700, no*********@fre enet.de wrote:

First off, DllImport Will Fail, those two files are .NET assemblies -
not Win32 DLLs.
That's right - sorry, DllImport = stupid idea (Like I wrote: I'm a
newbie ;-) )
Second off, use the imports. The app will toss an exception if the
required DLLs are missing and you can then correct the problem.
When I start my application without those dlls, a dialog with the
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.Asse mbly.load(Micro soft.SqlServer. Replication) but it
doesn't seem that I can access the classes 'Server' and
'ServerConnecti on' with this. So I used
Reflection.Asse mbly.load(Micro soft.SqlServer. Smo) but that threw an
exception...

I wondered why I need the .Replication.dl l \ BatchParser.dll because
the two assemblies refer to .Smo.dll \ .ConnectionInfo .dll ?!?

Oct 10 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
5622
by: Seabass | last post by:
Hey all, I have come across the following issue. I have an application written with Borland C++ Builder, this application loads dlls(plug-ins) dynamically during run time. To make things easier for my users, I am trying to make it possible for them to create dlls in C++ Builder (which works great) and VC++. I tried to use the same code in...
3
1745
by: Clift Norris | last post by:
I've created a managed C++ assembly containing a managed class that is instantiated from ASP.NET. The managed C++ assembly needs msvcp71.dll and msvcr71.dll. When ASP.NET loads the assembly, it cannot locate the C++ runtime DLLs and hence throws an exception. I have placed the C++ runtime DLLs in the same directory as the managed C++...
0
3207
by: ZMan | last post by:
Scenario: This is about debugging server side scripts that make calls to middle-tier business DLLs. The server side scripts are legacy ASP 3.0 pages, and the DLLs are managed DLLs converted/developed with VB.NET. What I want from debugging is to be able to step into the methods in the DLLs called from ASP scripts using Visual Studio .NET. ...
29
4181
by: Natan | last post by:
When you create and aspx page, this is generated by default: using System; using System.Collections; using System.Collections.Specialized; using System.Configuration; using System.Text; using System.Text.RegularExpressions; using System.Web; using System.Web.Caching;
7
3093
by: Oenone | last post by:
I'm sure there's an obvious way to do this, but I'm missing it so far. I have an ASP.NET application that relies on several DLLs to work. Currently in order to get my site working I have to put them all in the bin/ folder within my web site's directory. As I have numerous web sites, I want to be able to place all of these DLLs just once...
3
1198
by: Hector Y. Martinez | last post by:
Hi everybody... my problem is: Well I want to make an app, that you the user could add some plugins (DLLs)... this plugins can contains classes that inherit from one class in my app, of course the user will only have the app in binary, not source code. Well, in C++ I know this could be made... but i need an idea in C# Please can you, send...
2
1974
by: Marty | last post by:
Hi, I would like to know about DLL and performance gain/penalty in an application. Let's say that I have a very big application and for component portability and easy maintenance, we fragmented the application in a numerous number of sub projects compiled as DLLs. So those sub project are very easy to use between different applications. ...
9
1973
by: yevvi | last post by:
Hi, We have a product with bunch of dlls which are now built with Visual Studio 2003. We want to switch the build to use VS2005. I have read that in VS2005 runtime libraries come as side-by-side assemblies and that application has to have a manifest binding it to those assemblies. My question is, can previously built apps use my new...
6
2412
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
Using Visual Studio 2005, I have created 4 small DLLs that our company projects can use to access common tools included in each of the separate DLL files. Our Visual Studio 2005 applications call the DLLs and run them without any problem. Now we are trying to deploy the first of these applications, and we are now stumped. The Visual...
0
7465
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
1
7416
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7752
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5969
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5325
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4944
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3449
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3441
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1878
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.