动态给objectdatasource传入list的问题,疑难
写了一个业务对象shared function(byval mylist as arraylist) as data.datatable,在页面上gridview用的数据源是objectdatasource,selectmethod用的方法是function,请问如何在后台动态的给objectdatasource传入一个arraylist呢?请指教! --------------------编程问答-------------------- 有人知道吗? --------------------编程问答-------------------- 不懂帮顶 --------------------编程问答-------------------- 给数据源传,那必须写sql插入。如果给gridview传,那就直接把list付给datasource就行了 --------------------编程问答-------------------- 在后台传要开启一个线程,用DATAREADER 遍历数据源.填充ARRAYLIST.
Dim t As Threading.Thread
Dim ts As New Threading.ThreadStart(AddressOf run)
Dim mainarraylist As ArrayList
Public Sub run()
mainarraylist = setarr(dr)
End Sub
Public Function setarr(ByVal dr As Data.SqlClient.SqlDataReader) As ArrayList
Dim al As New ArrayList
While dr.Read
Dim i As Integer
For i = 0 To dr.FieldCount - 1
al.Add(dr(i))
Next
End While
Return al
End Function
还要运T.START 什么时候运行要靠你了.线程数据共亨,挺麻烦的了.你要自己写了. --------------------编程问答-------------------- 楼主要可以换个思路解决了, 不一定非得这样做啦,
补充:.NET技术 , VB.NET