public void insertData(int id,string name)
{
con.Open();
try
{
cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandText = "Procedure_Name";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@id",id);
cmd.Parameters.AddWithValue("@name",name);
int result=con.executeNonQuery();
}
catch (Exception ex)
{
}
finally
{
con.Close();
}
}
{
con.Open();
try
{
cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandText = "Procedure_Name";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@id",id);
cmd.Parameters.AddWithValue("@name",name);
int result=con.executeNonQuery();
}
catch (Exception ex)
{
}
finally
{
con.Close();
}
}
No comments:
Post a Comment