W
WStoreyII
i got this code straight out of the msdn but it is not working i get in an
exception when it tries to fill the dataset what is wrong?
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim DS As System.Data.DataSet
Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
Dim MyConnection As System.Data.OleDb.OleDbConnection
MyConnection = New
System.Data.OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0; " &
"data source=C:\myData.XLS; " & "Extended Properties=Excel 9.0;")
' Select the data from Sheet1 of the workbook.
MyCommand = New System.Data.OleDb.OleDbDataAdapter("select * from
[Sheet1$]", MyConnection)
DS = New System.Data.DataSet("DS")
MyCommand.Fill(DS)
DataGrid1.DataSource = DS
MyConnection.Close()
End Sub
Thanks for the help
WStoreyII
exception when it tries to fill the dataset what is wrong?
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim DS As System.Data.DataSet
Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
Dim MyConnection As System.Data.OleDb.OleDbConnection
MyConnection = New
System.Data.OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0; " &
"data source=C:\myData.XLS; " & "Extended Properties=Excel 9.0;")
' Select the data from Sheet1 of the workbook.
MyCommand = New System.Data.OleDb.OleDbDataAdapter("select * from
[Sheet1$]", MyConnection)
DS = New System.Data.DataSet("DS")
MyCommand.Fill(DS)
DataGrid1.DataSource = DS
MyConnection.Close()
End Sub
Thanks for the help
WStoreyII