Advertisement
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: |
Private Sub GetExcelData(ByVal file As String, ByVal sheet As String)
Try
' pre-init progress bar ...
pbrData.Minimum = 0
pbrData.Maximum = 100
' clear the table ...
dt.Clear()
' HDR = header (set = no, if no header row) ...
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & file _
& "; Extended Properties=""Excel 8.0;HDR=No;IMEX=1"""
Dim xlCn As OleDb.OleDbConnection = New OleDb.OleDbConnection
xlCn = MakeCnn(xlCn, strConn)
xlCn.Open()
' delineate the sheet name with a $ after it ...
' select data [optional cell range just after sheet name] ...' eg [April$A1:AD83]"
' select columns (F1, F2 ...)
Dim xlSql As String = "SELECT * FROM [" & sheet & "$]"
Dim xlDA As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter(xlSql, xlCn)
xlDA.Fill(dt)
' init progress bar ...
pbrData.Minimum = 0
pbrData.Maximum = dt.Rows.Count
' send to grid ...
grdCalls.DataSource = dt
Catch x As OleDbException
Alert(x.Message, MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
|
|
[x]
The Solution Rating System
|
||
|
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
|
Loading Advertisement... |