返回首页

我从Excel导入数据,我要显示的数据导入进度条的进度,我都试过,但我没有得到请给予解决

文字下面的评论已经从[编辑] [/编辑]


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

回答

评论会员: 时间:2