Private Function read_from_xls(ByVal Pfad As String)
Try
Dim Dateiname As String = Dir(Pfad & "\*.xls")
Dim Quellpfad As String = Pfad & Dateiname
' Testausgabe
'MessageBox.Show(Quellpfad, "Quellpfad")
Dim MyConnection As System.Data.OleDb.OleDbConnection
MyConnection = New System.Data.OleDb.OleDbConnection( _
"provider=Microsoft.Jet.OLEDB.4.0; " & _
"data source= " & Quellpfad & " ; " & _
"Extended Properties=Excel 8.0;")
' Daten aus Tabelle1 auslesen
Dim MyCommand As System.Data.OleDb.OleDbCommand
MyCommand = New System.Data.OleDb.OleDbCommand( _
"select * from [Sheet1$]", MyConnection)
'MyCommand-Daten in das DS schreiben
Dim DS As New DataSet("Excel-Inhalt")
' ### Wie übertrage ich die Daten hier in das Dataset? ###
'DS.?
' ### Wie bekomme ich die Daten hier in das Datagrid ? ###
Dim DataGrid1 = New DataGrid
DataGrid1.Datasource = DS.Tables("daten1")
MyConnection.Close()
Return DS
Catch ex As Exception
MessageBox.Show(ex.Message, "Auslesen gescheitert")
'Dim Wert As Exception = ex.InnerException()
'MessageBox.Show(Wert, "Inner Exception")
Return False
End Try
End Function