protected void btn_regist_Click(object sender, EventArgs e) { try { userinfo.UserName = Username.Text.Trim(); userinfo.Name = Truename.Text.Trim(); userinfo.Password = password_confirmation.Text.Trim(); userinfo.Email = email.Text.Trim(); userinfo.Address = address.Text.Trim(); userinfo.Datetime = DateTime.Now.ToString(); int i = Bll_UserInfo.Add_User(userinfo); if (i > 0) { Response.Write(" <script>function window.onload() {alert( 'Regist Sucessfully' ); } </script> "); } else { Response.Write(" <script>function window.onload() {alert( 'Regist Failed' ); } </script> "); } } catch (Exception xx) { Response.Write(" <script>function window.onload() {alert( '" + xx.ToString() + "' ); } </script> "); } }
private void button1_Click(object sender, EventArgs e) { user.UserName = txt_username.Text.Trim(); user.Password = txt_repwd.Text.Trim(); user.Email = txt_email.Text.Trim(); user.Name = txt_truename.Text.Trim(); user.Address = txt_address.Text.Trim(); user.Datetime = DateTime.Now.ToString(); try { int i = Bll_UserInfo.Add_User(user); if (i > 0) { MessageBox.Show("Added Successfully"); } else { MessageBox.Show("Added Failed"); } } catch { MessageBox.Show("Added Error,Try again!"); } }