To Create Procedure Go to solution explorer expand database and from the stored Procedure , right click on it and choose new stored procedure
ALTER PROCEDURE dbo.Insertion
(
@f1 varchar,
@f2 varchar,
)
AS
/* SET NOCOUNT ON */
insert into table2
(
field1,
field2
)
values
(
@f1,
@f2
)
RETURN
protected void Button1_Click(object sender, EventArgs e)
{
string conn = "ConnectionString";
SqlConnection sqlcon = new SqlConnection(conn);
sqlcon.Open();
SqlCommand comm = new SqlCommand("Insertion", sqlcon);
comm.CommandType = CommandType.StoredProcedure;
comm.Parameters.AddWithValue("f1", int.Parse(txtid.Text.ToString()));
comm.Parameters.AddWithValue("f2", Txtname.Text.ToString());
comm.ExecuteNonQuery();
}
hope this will help you!!