动态进度条 [英] Dynamic progress bar

查看:73
本文介绍了动态进度条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从Excel导入数据,我想显示进度条中数据导入的进度,我已经尝试过,但是我没有提供解决方案

以下文本已从评论中移出[/EDIT]

I am importing Data from Excel I want to show progress of the data import in progress bar, I have tried but I didn''t got pls give the solution

Text below has been moved from comment[/EDIT]

Dim MyConnection As System.Data.OleDb.OleDbConnection
Try
    ''''''' Fetch Data from Excel
    'Dim DtSet As System.Data.DataSet
    Dim MyCommand As System.Data.OleDb.OleDbDataAdapter

    MyConnection = New System.Data.OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0; " & _ "data source='" & PrmPathExcelFile & " '; " & "Extended Properties=Excel 8.0;")
    ' Select the data from Sheet1 of the workbook.
    MyCommand = New System.Data.OleDb.OleDbDataAdapter("select * from [PDFDATA$] where id is not null", MyConnection)
    MyCommand.TableMappings.Add("Table", "Attendence")
    DtSet = New System.Data.DataSet
    MyCommand.Fill(DtSet)
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    DataGrid1.DataSource = DtSet.Tables(0)
    MyConnection.Close()
    Catch ex As Exception
    MyConnection.Close()
End Try

推荐答案

其中的ID不为空" ,MyConnection) MyCommand.TableMappings.Add(" " 出勤" ) DtSet = 新建 System.Data.DataSet MyCommand.Fill(DtSet) ''' ''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''' DataGrid1.DataSource = DtSet.Tables( 0 ) MyConnection.Close() 捕获,例如 As 异常 MyConnection.Close() 结束 尝试
where id is not null", MyConnection) MyCommand.TableMappings.Add("Table", "Attendence") DtSet = New System.Data.DataSet MyCommand.Fill(DtSet) ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' DataGrid1.DataSource = DtSet.Tables(0) MyConnection.Close() Catch ex As Exception MyConnection.Close() End Try


在您的代码段中,您不会自己逐行导入.您正在选择整个Excel工作表,但不会报告进度.所要使用的代码无法实现您想要的,坦率地说,更改代码这样做只会减慢它的速度,因为您必须自己解析每一行才能满足WHERE子句.
In your code snippet, you''re not importing row-by-row yourself. You''re selecting the entirety of the Excel sheet, which doesn''t report progress. What you want isn''t possible with the code you''re using, and frankly, changing the code to do so would only slow it down as you''d have to parse each row yourself to satisfy the WHERE clause.


这篇关于动态进度条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆