Dim sqlC As String = ""
Dim DT As New DataTable
Dim sendStatus As Integer
sqlC = "Select c.* "
sqlC &= "FROM Clother c
sqlC &= "WHERE c.No=" & tClother
DT = FShowData(sqlItem)
If DT.Rows.Count > 0 Then
For i As Integer = 0 To DgvItem.Rows.Count - 1
If DgvItem.Rows(i).Cells(0).Value <> DT.Rows(i).Item("Code") Then
sendStatus = FuncInsert(CStr(DgvItem.Rows(i).Cells(0).Value))
End If
Next
End If
Code (VB.NET) แบบที่สอง ขึ้น Error
Dim sqlC As String = ""
Dim DT As New DataTable
Dim sendStatus As Integer
sqlC = "Select c.* "
sqlC &= "FROM Clother c
sqlC &= "WHERE c.No=" & tClother
DT = FShowData(sqlItem)
If DgvItem.Rows.Count > 0 Then
For i As Integer = 0 To DgvItem.Rows.Count - 1
If (CStr(DgvItem.Rows(i).Cells("Code").Value) <> "") Then
Dim dr As DataGridViewRow
dr = DgvItem.Rows(i)
DT.TableName = "Code"
If DT.Rows.Count > 0 Then
For j As Integer = 0 To DT.Rows.Count - 1
If CStr(DgvItem.Rows(i).Cells("Code").Value) <> CStr(DT.Rows(j).Item("Code")) Then
sendStatus = FuncInsert(CStr(DgvItem.Rows(i).Cells(0).Value))
End If
Next
End If
DT.Rows.Add(dr.Cells("Code").Value).ToString() >> Error Line: Value was either too large or too small for an Int32.Couldn't store <130027646001> in No Column. Expected type is Int32.
End If
Next
End If
DT.Dispose()
DT = Nothing