Friday, March 23, 2012

It doesnt execute my assemblies.

Hello I just did 2 stored procedures, they dont have errors and they deployed succesfully but after I tried to exec them it doesnt happen anything.
I waited for 10 minutes and nothing

using System;

using System.Data;

using System.Data.Sql;

using System.Data.SqlClient;

using System.Data.SqlTypes;

using Microsoft.SqlServer.Server;

public partial class StoredProcedures

{

[Microsoft.SqlServer.Server.SqlProcedure]

public static void getSalesOrdersHeaders()

{

// Put your code here

SqlPipe sp = SqlContext.Pipe;

using (SqlConnection conn = new SqlConnection(@."Data Source=ESTACION15\SQL2005; User Id=pruebas; Password=pruebas;database=AdventureWorks;"))

{

conn.Open();

SqlCommand cmd = new SqlCommand();

cmd.CommandType = CommandType.Text;

cmd.Connection = conn;

cmd.CommandText = "select * from sales.SalesOrderHeader";

SqlDataReader rdr = cmd.ExecuteReader();

sp.Send(rdr);

}

}

};

I tried to run it from visual studio .net and I get A TimeOut error

Error 1 Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. Pubs|||

How did you run it from Visual Studio?
From server explorer, test scripts or database project script

Thanks,
-Vineet.

|||Hello. It suddently began working after restarting my machine. Strange behavior.|||same here. It works after restarting my machine. Is this really normal? Any hints on this one?|||dunno if this is relevant or what you wrote was intended, but by creating the connection like you do you're creating a new connection from the connection your sproc's already using.


SqlConnection conn = new SqlConnection("context connection = true");


will get a reference to the existing one.
more info @. http://codebetter.com/blogs/sahil.malik/archive/2005/07/26/129824.aspx

No comments:

Post a Comment