How to create stored procedure

Create stored procedure:

create procedure p1 (@id int,  @Name varchar(50)) as
begin
insert into t1 values(@id,@Name)
end

Call from Front end:

connection.con.Open();
SqlCommand oc = new SqlCommand("p1",connection.con);
      oc.CommandType = CommandType.StoredProcedure;
oc.Parameters.AddWithValue("@id",1);
      oc.Parameters.AddWithValue("@Name", ‘aaa');
 oc.ExecuteNonQuery();
 connection.con.Close();
Ebook Download
View all
Learn
View all