N
normanchong
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 ;-)
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 ;-)