內我怎樣才能內(列表視圖)顯示的資料,因此,當他發現該項目是由藍色指示的(列表視圖)內如何搜索列表視圖
private void butsearch_Click(object sender, EventArgs e)
{
SqlConnection cn = new SqlConnection(Class1.x);
DataSet mydata = new DataSet();
mydata.Clear();
SqlDataAdapter db = new SqlDataAdapter("SELECT * FROM okk WHERE username LIKE '%" + textBox4.Text + "%'", cn);
db.Fill(mydata, "uspas");
textBox4.DataBindings.Clear();
textBox4.DataBindings.Add("text", mydata, "uspas.okk");
listView1.SelectedItems.data....// I could not be completed because I do not know
}
不要使用SQL查詢這個樣子。這是非常不安全和不好的做法。使用SQL命令,而不是http://www.codeproject.com/KB/database/sql_in_csharp.aspx – 2012-01-09 13:45:26