防刷新多次提交
如果你是根据参数来插入数据的话可以用此方法
protected void Page_PreInit(object sender, EventArgs e)
{
if (Request.QueryString["id"] != null)
{
SqlCommand cmd = new SqlCommand("insert into jobs values(@job_desc,@min_lvl,@max_lvl)", con);
con.Open();
cmd.Parameters.Add("@job_desc", SqlDbType.VarChar).Value = "luca";
cmd.Parameters.Add("@min_lvl", SqlDbType.Int).Value = 50;
cmd.Parameters.Add("@max_lvl", SqlDbType.Int).Value = 40;
cmd.ExecuteNonQuery();
con.Close();
Response.Redirect("~/default2.aspx",true);
}
}