我想实现跨网页查询 将TextBox1.Text作为select 约束中的条件请问如何实现呢?
这是我自己想的但是错的,麻烦大家帮忙修改指正下
在webform1的Button1_Click 中添加如下代码:
private void Button1_Click
(object sender, System.EventArgs e)
{
string url;
url="webform2.aspx?name=" +
TextBox1.Text;
Response.Redirect(url);
}
在webform2的Page_Load中添加如下代码:(select的片段)
StuSQL = "SELECT username as 姓名 ,address as 家庭住址 ,sex as 性别 ,phonumber as 手机号,age as 年龄,officesite as 工作编号,officephone as 单位电话 FROM userinfo WHERE username=Request.QueryString["name"]";
------解决方案--------------------------------------------------------
StuSQL = "SELECT username as 姓名 ,address as 家庭住址 ,sex as 性别 ,phonumber as 手机号,age as 年龄,officesite as 工作编号,officephone as 单位电话 FROM userinfo WHERE username='" + Request.QueryString["name"] + "'";