我在一页上有 2 个面板(SAPInfo、OSInfo)。在 SAPInfo 面板中有 3 个文本框(SID、Client、User_id)和 1 个搜索按钮。单击搜索按钮后,我想在下一页的 Gridview 中显示 SAP 表的数据(user_id、Descriptio、sap_system_password)。同样在 OSInfo 面板中有 2 个文本框(IP/HostName,User_id)和 1 个 SEARCH 按钮。单击搜索按钮后,我想在同一个 Gridview 中显示 OS 表(user_id、Descriptio、os_system_password)的数据。Gridview 有 4 列(UserID,Description,Password,Change Password) SAP 表包含字段为(sid,client_no,user_id,sap_system_password,description) OS 表包含字段为(user_id,ip,host_name,os_system_password,description) 怎么做这个?请帮助..这是我的搜索按钮(SAP)代码
protected void btnSAPSearch_Click(object sender, EventArgs e)
{
try
{
using (MySqlConnection conn = new MySqlConnection(clsUser.connStr))
{
conn.Open();
string strQuery = "select DISTINCT user_id,description,sap_system_password from sap_password_info where user_id is not null";
if (txtSid.Text !="")
{
strQuery += " AND sid = '" + txtSid.Text + "'";
}
if (txtClient.Text != "")
{
strQuery += " AND client_no = '" + txtClient.Text + "'";
}
if (txtUser.Text != "")
{
strQuery += " AND user_id = '" + txtUser.Text + "'";
}
MySqlCommand cmd = new MySqlCommand(strQuery, conn);
DataTable dt = new DataTable();
dt.Load(cmd.ExecuteReader(CommandBehavior.CloseConnection));
Session["userinfo"] = dt;
Response.Redirect("~\\PasswordInformation_Details.aspx");
}
}
catch (Exception ex)
{
//lblMessage.Text = DataObjects.Error_Message();
lblMsg.Text = ex.Message.ToString();
}
}