hi all
at the moment i have the code below which works fine but i need to add another colum that adds the total of a field but the problem is it errors out if i try to open another connection while in the while it needs to add the total of price while TransID = Rec.Fields("TransID").Value
at the moment i have the code below which works fine but i need to add another colum that adds the total of a field but the problem is it errors out if i try to open another connection while in the while it needs to add the total of price while TransID = Rec.Fields("TransID").Value
VB.NET:
'read data
Rec.Open("SELECT * FROM records order by TransID DESC", Conn, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic)
Dim trasid As Integer = 0
Dim disptrans As Integer = 0
Dim transtolal As Decimal = 0
If Not Rec.EOF Then
trasid = Rec.Fields("TransID").Value + 1
End If
While Not Rec.EOF
If Rec.Fields("TransID").Value < trasid And disptrans < 4 Then
trasid = Rec.Fields("TransID").Value
disptrans = disptrans + 1
DataGridView2.Rows.Add(Rec.Fields("TransID").Value, Rec.Fields("Sold").Value)
End If
Rec.MoveNext()
End While
Rec.Close()