Re: sp_help_job (HELP)
From: William Ryan eMVP (dotnetguru_at_comcast.nospam.net)
Date: 05/11/04
- Next message: Bin Song, MCP: "RE: "Vertical Slice" of a DataSet"
- Previous message: Brooke Philpott: "Re: Exception in System.Data.SqlClient.DefaultPoolControl.ObtainSidInfo"
- In reply to: jzink: "sp_help_job (HELP)"
- Next in thread: jzink: "Re: sp_help_job (HELP)"
- Reply: jzink: "Re: sp_help_job (HELP)"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 11 May 2004 09:21:27 -0400
More:
I wrapped it in a try catch block and tried to break it. If you don't have
it spelled right it will tell you it can't find the job. The only thing
that I can get to mimc this is with insufficient permissions, but to do that
the account still has to have db persmissions to open the connection (sinc
eyou are opening it early on, this isn't the problem.
I looked through our stuff yesterday and can't find it but just to be sure,
it's defintely the Fill line that's causing this right?
For easy, why not try catch it and see if we can garner some more info from
the exception...I already wrapped it in the previous snippet.
Bill
www.devbuzz.com
www.knowdotnet.com
"jzink" <anonymous@discussions.microsoft.com> wrote in message
news:3DBF343E-7B9C-4F3D-943F-EEBD28898443@microsoft.com...
> Can anyone get sp_help_job to execute via ado.net ???
>
> The following code produces a "severe error occurred on the command
object":
>
> SqlConnection connection = new SqlConnection(connectionString);
> connection.Open();
> SqlCommand cmd = new SqlCommand();
> cmd.Connection = connection;
> cmd.CommandText = "exec msdb.dbo.sp_help_job @job_name='My SQL
Job',@job_aspect='JOB'";
> cmd.CommandType = System.Data.CommandType.Text;
> cmd.CommandTimeout = 90;
> SqlDataAdapter da = new SqlDataAdapter(cmd);
> DataSet ds = new DataSet();
> da.Fill(ds);
> connection.Close();
>
> I can execute the same command Text in SQL Query Analyzer without a
problem (using the same connection id and pwd).
> Even if I don't pass any parms I get the error. I've tried to execute it
as a proc and as text.
>
> Any ideas ???
>
- Next message: Bin Song, MCP: "RE: "Vertical Slice" of a DataSet"
- Previous message: Brooke Philpott: "Re: Exception in System.Data.SqlClient.DefaultPoolControl.ObtainSidInfo"
- In reply to: jzink: "sp_help_job (HELP)"
- Next in thread: jzink: "Re: sp_help_job (HELP)"
- Reply: jzink: "Re: sp_help_job (HELP)"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|