给spread绑定大量数据后,再设置RowCount = 0清空表格,这一操作使得spread有性能问题(start_0到end_0需要30多秒的相应),请问这个问题有解决方案吗?
Public rowCount = 170000
Public Function setDtData() As DataTable
Dim dt As DataTable = New DataTable
dt.Columns.Add("ISITU_C")
dt.Columns.Add("ISITU_NJ")
dt.Columns.Add("GORD_NO")
dt.Columns.Add("SAMP_NO")
dt.Columns.Add("BIKOU_NJ3")
dt.Columns.Add("KENSA_STS")
For index = 1 To rowCount
Dim dr As DataRow = dt.NewRow
dr(0) = index.ToString + "-ISITU_C"
dr(1) = index.ToString + "-ISITU_NJ"
dr(2) = index.ToString + "-GORD_NO"
dr(3) = index.ToString + "-SAMP_NO"
dr(4) = index.ToString + "-BIKOU_NJ3"
dr(5) = index.ToString + "-KENSA_STS"
dt.Rows.Add(dr)
Next
Return dt
End Function
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim dstDataList As DataSet = New DataSet
Dim dtList As DataTable = Nothing
dtList = setDtData()
dstDataList.Tables.Add(dtList)
If Not dstDataList Is Nothing Then
FpSpread1.ActiveSheet.DataSource = dstDataList
End If
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
tempStr = ""
tempStr += Now.ToString("yyyyMMddHHmmss") + ":" + "start_0" + vbCrLf
FpSpread1.ActiveSheet.RowCount = 0
tempStr += Now.ToString("yyyyMMddHHmmss") + ":" + "end_0" + vbCrLf
WriteLog(tempStr)
End Sub
|