hi All ,
I am creating a program that will import the data of excel files to my datagridview on my program.
here is the code i search.
it throws an exception message thatCode:Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Try Dim MyConnection As System.Data.OleDb.OleDbConnection Dim dataset As System.Data.DataSet Dim myCommand As System.Data.OleDb.OleDbDataAdapter Dim path As String = "C:\\Users\\lb770017\\Documents\\test.xlsx" MyConnection = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties 12.0;") myCommand = New System.Data.OleDb.OleDbDataAdapter("select * from [Sheet1$]", MyConnection) dataset = New System.Data.DataSet myCommand.Fill(dataset) DataGridView1.DataSource = dataset.Tables(0) MyConnection.Close() Catch ex As Exception MsgBox(ex.Message.ToString) End Try End Sub
format of the initialization string does not conform to specification starting at index 88
my excel file will only compose 1 column
![]()




Reply With Quote
