protected void Button16_Click(object sender, EventArgs e) { if (this.TextBox1.Text == "" && temp1 != null) { this.TextBox1.Text = temp1.ToString(); dot = true; } else { double temp3 = 0.0; temp2 = Convert.ToDouble(this.TextBox1.Text); localhost.Service result = new localhost.Service(); switch (m) { case 0: temp3 = result.Sum(temp1, temp2); break; case 1: temp3 = result.Sub(temp1, temp2); break; case 2: temp3 = result.Mult(temp1, temp2); break; case 3: temp3 = result.Div(temp1, temp2); break; default: Response.Write("数据有误,请重新输入!"); break; } if (temp3 > double.MaxValue) { Response.Write("<script>alert('结果值超出双精度最大值!')</script>"); return; } this.TextBox1.Text = temp3.ToString(); dot = true; } }
protected void BtnReg_Click(object sender, EventArgs e) { string cmdtxt = "Insert into [user]([uname],[upassword],[email],[phone]) VALUES('" + this.txtUname.Text + "'"; cmdtxt += ",'" + this.txtPwd.Text + "','" + this.txtEmail.Text + "','" + this.txtPhone.Text + "');"; localhost.Service InsertData = new localhost.Service(); bool i = InsertData.CommandSql(ConnectionString, cmdtxt); //Response.Write(cmdtxt); if (i == true) { Response.Write("<script>alert('添加成功!');location='Register.aspx'</script>"); } else { Response.Write("<script>alert('添加失败!');location='Register.aspx'</script>"); } Show_Table(); }