I have the following code which retreives data from Excel spreadsheet.
How do I exclude or delete records from the table that have blank first column, I do not need to write the records back.
Thanks
Peter
Dim excelConnection As System.Data.OleDb.OleDbConnection
Dim dbg As DataGrid
Dim DtSet As New System.Data.DataSet
Try
'
' Fetch Data from Excel
'
Dim cmd As System.Data.OleDb.OleDbDataAdapter
excelConnection = New System.Data.OleDb.OleDbConnection("provider=Micros oft.Jet.OLEDB.4.0; " & _
"data source='" & pathExcelFile & " '; " & "Extended Properties=Excel 8.0;")
'
' Select the data from sheet of the workbook.
'
cmd = New System.Data.OleDb.OleDbDataAdapter("select * from [" & workSheetName & "$]", excelConnection)
cmd.TableMappings.Add("Table", "Data")
cmd.Fill(DtSet)
Catch ex As Exception
excelConnection.Close()
Finally
excelConnection.Close()
End Try
Return DtSet.Tables(0)