一次篩選
ilist
<
model
>
list
=(ilist
<
model
>
)datagridview2.datasource;
var query
=from student
inlist
//where student.formcode.startswith(textbox3.text.trim())
where
student.formcode.contains(textbox3.text.trim())
//where student.formcode.endswith(textbox3.text.trim())
=new
localdataer.bindingcollection
<
model
>
(query.tolist());
真正的仿繫結datatable實現
var query
=from student
inlistsouse
//where student.formcode.startswith(textbox3.text.trim())
where
student.formcode.contains(textbox3.text.trim())
//where student.formcode.endswith(textbox3.text.trim())
=new
localdataer.bindingcollection
<
model
>
(query.tolist());
這裡的listsouse是乙個不變的泛型集合,採用的是linq查詢,大家可以隨意修改可實現不同效果,如果好的方法也請通知我,謝謝
DataGridview 繫結泛型List
1 datagridview資料繫結對比 datatable與泛型list 當datagridview的datasource是datatable的時候,datatable的資料改變時,datagridview的資料會隨之改變,無需重新繫結到datagridview。當datagridview的dat...
DataGridview 繫結泛型List
1 datagridview資料繫結對比 datatable與泛型list 當datagridview的datasource是datatable的時候,datatable的資料改變時,datagridview的資料會隨之改變,無需重新繫結到datagridview。當datagridview的dat...
datagridview資料繫結
sqlconnection conn new sqlconnection conn.connectionstring server local uid sa pwd sa database databasename sqlcommand cmd new sqlcommand cmd.commandt...