Private Sub BtISave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtISave.Click
For j As Integer = 2 To FpSpread2.Sheets(0).RowCount - 1
Try
ADDDAML("INSERT INTO XX (DL,XH,MC,N,Y,R,FS,YS,BS,BM,BZ) VALUES ('" & FpSpread2.Sheets(0).Cells(j - 1, 1).Tag.ToString & "','" & FpSpread2.Sheets(0).Cells(j, 0).Text & "','" & FpSpread2.Sheets(0).Cells(j, 1).Text & "','" & FpSpread2.Sheets(0).Cells(j, 2).Text & "','" & FpSpread2.Sheets(0).Cells(j, 3).Text & "','" & FpSpread2.Sheets(0).Cells(j, 4).Text & "','" & FpSpread2.Sheets(0).Cells(j, 5).Text & "','" & FpSpread2.Sheets(0).Cells(j, 6).Text & "','" & H & "','" & LbXM.Tag.ToString & "','" & FpSpread2.Sheets(0).Cells(j, 7).Text & "')", 0) Then
Catch ex As Exception
End Try
代码如上,这是一个数据库插入数据代码,偶尔会出现invalid row index :**寻思半天也没发现有什么问题,请高手看看有什么问题? |
|