G
Guest
I don't know id this is ADO but the SQLServer.clr newgroup is not in the
managed groups list so sorry if I have misposted
I have an one clr stored procedure that would like to call from another
another.
public static void ParentSproc(SqlInt64 id, SqlString userName, out
SqlInt32 recordsAffected)
{
using (SqlConnection connection = new SqlConnection("context
connection=true"))
{
SqlCommand command = new SqlCommand();
command.Connection = connection;
command.CommandText = @"DELETE FROM Blah WHERE id= @id";
SqlParameter p_id = new SqlParameter("@id", SqlDbType.BigInt);
p_id.Value = id;
command.Parameters.Add(p_id);
connection.Open();
recordsAffected = command.ExecuteNonQuery();
connection.Close();
if (recordsAffected > 0)
{
Audit(id, "Blah ", "DELETE", userName);
}
}
}
This works well except I would like to pass the command or the connection
through so it can be reused. and not have to be closed and reopened.
But when I deploy to SQL Server it complains that the Command object is not
a SqlParameter type, (which, in fact, it's not). So is there a way to wrap
numerous sprocs in one connection?
Thanks
Robert Zurer
managed groups list so sorry if I have misposted
I have an one clr stored procedure that would like to call from another
another.
public static void ParentSproc(SqlInt64 id, SqlString userName, out
SqlInt32 recordsAffected)
{
using (SqlConnection connection = new SqlConnection("context
connection=true"))
{
SqlCommand command = new SqlCommand();
command.Connection = connection;
command.CommandText = @"DELETE FROM Blah WHERE id= @id";
SqlParameter p_id = new SqlParameter("@id", SqlDbType.BigInt);
p_id.Value = id;
command.Parameters.Add(p_id);
connection.Open();
recordsAffected = command.ExecuteNonQuery();
connection.Close();
if (recordsAffected > 0)
{
Audit(id, "Blah ", "DELETE", userName);
}
}
}
This works well except I would like to pass the command or the connection
through so it can be reused. and not have to be closed and reopened.
But when I deploy to SQL Server it complains that the Command object is not
a SqlParameter type, (which, in fact, it's not). So is there a way to wrap
numerous sprocs in one connection?
Thanks
Robert Zurer