TonyReba
asked on
Stored Procedure to Update all tables
I have several tables on my database , each table has a Id, and a status column, I want to call a stored procedure in a click event of an asp.net button .
How would I do this?
protected void Button33_Click(object sender, EventArgs e)
{
using (SqlConnection connection = new SqlConnection(Configuratio nManager.C onnectionS trings["ap pdevConnec tionString 7"].Connec tionString ))
{
using (SqlCommand command = new SqlCommand("sp_ClearStatus ", connection))
{
command.CommandType = CommandType.StoredProcedur e;
// command.Transaction.
// command.Parameters.AddWith Value("@Id ", txName.Text.Trim());
// command.Parameters.AddWith Value("@St atus", txtDescription.Text.Trim() );
connection.Open();
command.ExecuteNonQuery();
}
}
How would I do this?
protected void Button33_Click(object sender, EventArgs e)
{
using (SqlConnection connection = new SqlConnection(Configuratio
{
using (SqlCommand command = new SqlCommand("sp_ClearStatus
{
command.CommandType = CommandType.StoredProcedur
// command.Transaction.
// command.Parameters.AddWith
// command.Parameters.AddWith
connection.Open();
command.ExecuteNonQuery();
}
}
ALTER PROCEDURE sp_ClearStatus
(
@Id int,
@Status nvarchar(50)
)
AS
Update NT1 set Status = 'Assigned' where Id = @Id
Update NT2 set Status = 'Assigned' where Id = @Id
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER