我用vb2008,也遇到了该问题,有时能够更新,有时却没有反应,数据库中没有变化。
期待高手解决!
Private Sub GetDataToDbYh(ByVal num As Integer)
Try
For i As Integer = 1 To num
Dim n1 As String = Dgv2.Rows(i - 1).Cells(0).Value.ToString
Dim n2 As Double = CType(Dgv2.Rows(i - 1).Cells(1).Value, Double)
Dim n3 As Double = CType(Dgv2.Rows(i - 1).Cells(2).Value, Double)
Dim n4 As Double = CType(Dgv2.Rows(i - 1).Cells(3).Value, Double)
Dim n5 As Double = CType(Dgv2.Rows(i - 1).Cells(4).Value, Double)
Dim n6 As Double = CType(Dgv2.Rows(i - 1).Cells(5).Value, Double)
Dim n7 As Double = CType(Dgv2.Rows(i - 1).Cells(6).Value, Double)
Dim n8 As Double = CType(Dgv2.Rows(i - 1).Cells(7).Value, Double)
Dim n9 As Double = CType(Dgv2.Rows(i - 1).Cells(8).Value, Double)
Dim n10 As Double = CType(Dgv2.Rows(i - 1).Cells(9).Value, Double)
Dim n11 As Double = CType(Dgv2.Rows(i - 1).Cells(10).Value, Double)
Dim n12 As Double = CType(Dgv2.Rows(i - 1).Cells(11).Value, Double)
Dim n13 As Double = CType(Dgv2.Rows(i - 1).Cells(12).Value, Double)
Dim n14 As Double = CType(Dgv2.Rows(i - 1).Cells(13).Value, Double)
Dim n15 As Double = CType(Dgv2.Rows(i - 1).Cells(14).Value, Double)
Dim n16 As Double = CType(Dgv2.Rows(i - 1).Cells(15).Value, Double)
Dim n17 As Double = CType(Dgv2.Rows(i - 1).Cells(16).Value, Double)
Dim n18 As Double = CType(Dgv2.Rows(i - 1).Cells(17).Value, Double)
Dim n19 As Double = CType(Dgv2.Rows(i - 1).Cells(18).Value, Double)
Dim n20 As Double = CType(Dgv2.Rows(i - 1).Cells(19).Value, Double)
Dim n21 As String = Dgv2.Rows(i - 1).Cells(20).Value.ToString
If n1 <> "" Then
Dim ins As New chenhui.chycom
Dim actab As DataTable = ins.CreateDataTable("select * from qdshjyh", "qdshjyh")