G
Guest
Hi,
I am trying to import an excel file into my vb.net app and populate a
datagrid. This is my code
Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
Dim MyConnection As System.Data.OleDb.OleDbConnection
Dim NewRecord As Boolean = False
Try
MyConnection = New System.Data.OleDb.OleDbConnection( _
"provider=Microsoft.Jet.OLEDB.4.0; " & _
"data source=c:\sb1.xls; " & _
"Extended Properties=""Excel
8.0;IMEX=1;ReadOnly:=True;UpdateLinks:=0""")
MyCommand = New System.Data.OleDb.OleDbDataAdapter( _
"select * from [sheet1$]", MyConnection)
Dim dsi As DataSet
dsi = New System.Data.DataSet
MyCommand.Fill(dsi) -------------------------> stops here
MyConnection.Close()
grdStarBucks.DataSource = dsi.Tables(0)
Catch
End Try
MyConnection.Close()
It stops at MyCommand.Fill(dsi). Any ideas?
Thanks
I am trying to import an excel file into my vb.net app and populate a
datagrid. This is my code
Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
Dim MyConnection As System.Data.OleDb.OleDbConnection
Dim NewRecord As Boolean = False
Try
MyConnection = New System.Data.OleDb.OleDbConnection( _
"provider=Microsoft.Jet.OLEDB.4.0; " & _
"data source=c:\sb1.xls; " & _
"Extended Properties=""Excel
8.0;IMEX=1;ReadOnly:=True;UpdateLinks:=0""")
MyCommand = New System.Data.OleDb.OleDbDataAdapter( _
"select * from [sheet1$]", MyConnection)
Dim dsi As DataSet
dsi = New System.Data.DataSet
MyCommand.Fill(dsi) -------------------------> stops here
MyConnection.Close()
grdStarBucks.DataSource = dsi.Tables(0)
Catch
End Try
MyConnection.Close()
It stops at MyCommand.Fill(dsi). Any ideas?
Thanks