protected void Button1_Click(object sender, EventArgs e)
    {
        SqlConnection con = DB.CreateCon();
        con.Open();
        ShowMsg("成功");
        SqlTransaction tran = con.BeginTransaction();
       
            SqlCommand cmd = new SqlCommand("insert into login values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "')", con);
            //cmd.ExecuteNonQuery();
            cmd.Transaction = tran;
            try
            {
                cmd.ExecuteScalar();
                tran.Commit();
                ShowMsg("成功");
            }
            catch
            {
                tran.Rollback();
            }

    }
    protected void ShowMsg(string msg)
    {
        Literal lt = new Literal();
        lt.Text = "<script>alert('"+msg+"')</script>";
        Page.Controls.Add(lt);
    }