日期:2013-12-13  浏览次数:20818 次

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.DataBind()