从excel中读出文字显示到datagrid上

类别:Asp 点击:0 评论:0 推荐:

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

本文地址:http://com.8s8s.com/it/it7509.htm