Re: sp_help_job (HELP)

From: William Ryan eMVP (dotnetguru_at_comcast.nospam.net)
Date: 05/11/04


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 ???
>



Relevant Pages

  • [Full-Disclosure] Advanced usage of system() function.
    ... and call its arguments as a command for shell. ... as we can see we still didnt get what we want (typing exit ... Connection closed by foreign host. ... think what we want to execute. ...
    (Full-Disclosure)
  • Advanced usage of system() function.
    ... and call its arguments as a command for shell. ... as we can see we still didnt get what we want (typing exit we are ... Connection closed by foreign host. ... think what we want to execute. ...
    (Bugtraq)
  • Re: ADODB Command memory leak
    ... _ConnectionPtr conn = NULL; ... // Execute statement. ... > My logic is such that the connection to the database is not maintained ... Create/Append command parameters ...
    (microsoft.public.data.ado)
  • Re: ADODB Command memory leak
    ... My logic is such that the connection to the database is not maintained ... between calls to the Execute() method. ... Create/Append command parameters ... Destroy the command object ...
    (microsoft.public.data.ado)
  • Re: Wait for background processes to complete
    ... To be able to execute commands in the background and wait for their ... The documentation I am referring to is http://perldoc.perl.org/. ... You can run a command in the background with: ... There is a general problem with perl documentation: ...
    (comp.lang.perl.misc)