protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtuserName.Text.Trim().Length == 0) { strErr += "userName不能为空!\\n"; } if (this.txtuserPsw.Text.Trim().Length == 0) { strErr += "userPsw不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } string userName = this.txtuserName.Text; string userPsw = this.txtuserPsw.Text; zs.Model.Tbl_User model = new zs.Model.Tbl_User(); model.userName = userName; model.userPsw = userPsw; zs.BLL.Tbl_User bll = new zs.BLL.Tbl_User(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx"); }