SQLDMO and C#

G

Guest

Hi all, I am trying to get a reference to SQL Server
Agent from C#. I have referenced SQLDmo.dll in my
project. The SQLDmo documentation says SQLDMO.JobServer
instance would be a reference to SQL Server Agent.

From my C# project, however, SQLDMO.JobServer is shown as
an interface and hence I am not able to create an
instance of SQLDMO.JobServer.

Any help is appreciated. Thanks.
 
N

Nicholas Paldino [.NET/C# MVP]

I don't believe you can create new instances of a JobServer using a
constructor. Rather, you have to add a new instance through a method
somewhere else. You will have to use that method (whatever it is, I am not
sure, I can't find it in the documentation) and then cast the return value
to that interface.

Hope this helps.
 
S

Saras Asnani

All you have to do is in c# create your connection etc..
create the sqlcommand to be =
select * from master..sysdatabases
or
select * from master.dbo.sysdatabases
or
select * from master.user_with_rights_to_master.sysdatabases
or just select name from master.dbo.sysdatabases.
now either using a sqlreader or dataadapter get the results back...
you will still need the connection to either login as win pass thru or
sql id, sql password etc...
hope this helps,
-Saras Asnani.



Nicholas Paldino said:
I don't believe you can create new instances of a JobServer using a
constructor. Rather, you have to add a new instance through a method
somewhere else. You will have to use that method (whatever it is, I am not
sure, I can't find it in the documentation) and then cast the return value
to that interface.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hi all, I am trying to get a reference to SQL Server
Agent from C#. I have referenced SQLDmo.dll in my
project. The SQLDmo documentation says SQLDMO.JobServer
instance would be a reference to SQL Server Agent.

From my C# project, however, SQLDMO.JobServer is shown as
an interface and hence I am not able to create an
instance of SQLDMO.JobServer.

Any help is appreciated. Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top