Aspnub
Дата: 27.04.2010 11:42:24
Пытаюсь прочитать данные из Excel:
Imports System.Data.OleDb
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim strConnection As String = "Provider=Microsoft.Jet.OleDb.4.0;" & _
"data source=C:\order_in.xls;" & _
"Extended Properties=Excel 8.0;"
Dim objConnection As New OleDbConnection(strConnection)
Dim strSQL As String = "SELECT * FROM [Sheet1$]"
Dim myReader As OleDbDataReader
Dim objCommand As New OleDbCommand(strSQL, objConnection)
objConnection.Open()
myReader = objCommand.ExecuteReader()
GridView1.DataSource = myReader
GridView1.DataBind()
objConnection.Close()
End Sub
На строке GridView1.DataBind() выдает ошибку:
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
The connection for viewing your linked Microsoft Excel worksheet was lost.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
The connection for viewing your linked Microsoft Excel worksheet was lost.
Что за беда?