Read text from Excel to DataGrid

xiaoxiao2021-03-06  43

Dim myDataset As New DataSet Dim myOleDbConnection As OleDbConnection = New OleDbConnection ( "Provider = Microsoft.Jet.OLEDB.4.0;" & _ "Data Source = d: /2.xls;" & _ "Extended Properties =" "Excel 8.0; "" ") Dim myoledbcommand as oledbcommand = new oledbcommand (" Select * from [Sheet1 $], myoledbconnection) DIM MyData as oledbdataadapter = New OledbDataAdapter (MyoledbCommand)

MyData.Fill (MyDataSet)

DataGrid1.datasource = mydataset.tables (0) .defaultView DataGrid1.database ()

转载请注明原文地址:https://www.9cbs.com/read-67172.html

New Post(0)