데이터베이스가있는 웹 응용 프로그램 (ASP.NET)에서 작업하고 있습니다. 이 응용 프로그램을 통해 Excel 파일 (.xlsx)을 업로드하려고하면 문제가 없습니다. 이 문제는 파일이 24904 개가 넘는 레코드부터 시작됩니다.ASP.NET 응용 프로그램에서 MySQL로 Excel 파일을 업로드하는 중 오류가 발생했습니다.
나는 다음과 같은 오류가 그 시점에서:
This table contains cells that are outside the range of cells defined in this spreadsheet.
그것은 최초의 24,904 레코드를 기록합니다.
로드를 여러 배로 분할하려고 시도했지만 작동하지 않았습니다.
의견이 있으십니까?
Dim connExcel As New System.Data.OleDb.OleDbConnection(conStr)
Dim cmdExcel As New System.Data.OleDb.OleDbCommand()
Dim dt As New DataTable()
Dim dataset As New DataSet
Dim x As Integer = 2
Dim y As Integer = 20001
Dim range As String = "A" + x.ToString + ":" + "I" + y.ToString
cmdExcel.Connection = connExcel
If erro = 0 Then
Try
For i As Integer = 0 To 50
connExcel.Open()
dataset.Reset()
dataset.Clear()
Dim oda As New System.Data.OleDb.OleDbDataAdapter("SELECT * FROM [Sheet1$" & range.ToString & "]", connExcel)
oda.TableMappings.Add("Table", "ExcelTest")
oda.Fill(dataset)
connExcel.Close()
If dataset.Tables(0).Rows.Count > 0 Then
SendToDB(dataset)
Else
i = 50
End If
x = x + 20000
y = y + 20000
range = "A" + x.ToString + ":" + "I" + y.ToString
Next
Label7.Visible = True
Label7.Text = "The information has been written successfully from 0 to " + y.ToString
Catch ex As Exception
Label9.Visible = True
Label9.Text = "Database Error 2:" + ex.Message
connExcel.Close()
End Try
End If
오류를 일으키는 행은 무엇입니까? –
행 24905의 데이터에 정의 된 헤더 열 외부에 불필요한 데이터가 없다는 것을 확인 했습니까? – dhirschl
dhirschl - 선을 검사했는데 이상한 점이 없습니다. 나는 그것을 삭제하고 다음 줄에서 같은 문제가 발생했습니다. –