日期:2014-05-17 浏览次数:20902 次
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
ListBox2.Visible = true;
string constr = ConfigurationManager.ConnectionStrings["ConnStr1"].ToString();
OleDbConnection conn = new OleDbConnection(constr);
conn.Open();
string s = " select * from D_user where rename like '%"+ TextBox4 .Text +"%'";
OleDbDataAdapter da = new OleDbDataAdapter( );
da.SelectCommand = new OleDbCommand( s ,conn );
DataSet ds = new DataSet();
if (ds.Tables [0].Rows .Count !='0')
{
ListBox2.DataSource = ds.Tables[0];
ListBox2.DataTextField = ds.Tables[0].Rows[4].ToString();
ListBox2.DataValueField = ds.Tables[0].Rows[0].ToString();
ListBox2.DataBind();
}
else
{
Response.Write("无法找到匹配的联系人信息....");
}
conn.Close();
}