using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient; using System.Threading;
cs 文件代码
public partial class Demo1_Post : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) {
Thread.Sleep(5000); string username=this.txt_User.Text; SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["constr"]);
//throw new Exception("办法");
con.Open(); string sql = "Insert into Xk_User(Reg_Name,sex)values('"+username+"','21')"; SqlCommand cmd = new SqlCommand(sql, con); bool result = Convert.ToBoolean(cmd.ExecuteNonQuery()); if (result) { msgbox("提交成功");