1.TextMatrix(i, 2)
temp3 = MSHFlexGrid1.TextMatrix(i, 0)
MSHFlexGrid1.TextMatrix(i, 1) = sell.MSHFlexGrid1.TextMatrix(i, 3)
temp4 = MSHFlexGrid1.TextMatrix(i, 1)
MSHFlexGrid1.TextMatrix(i, 2) = sell.MSHFlexGrid1.TextMatrix(i, 4)
temp5 = MSHFlexGrid1.TextMatrix(i, 2)
MSHFlexGrid1.TextMatrix(i, 3) = sell.MSHFlexGrid1.TextMatrix(i, 5)
temp6 = MSHFlexGrid1.TextMatrix(i, 3)
temp1 = Label6.Caption
temp2 = sell.MSHFlexGrid1.TextMatrix(i, 1)
rb.Open "insert into 购物小票记录 (小票序列号,商品编码,商品名称,商品单价,商品数量,商品总价) values (" & temp1 & ",'" & temp2 & "','" & temp3 & "'," & temp4 & "," & temp5 & "," & temp6 & ")", db, adOpenStatic, adLockOptimistic
rb.Open "select * from 单笔销售信息存储", db, adOpenStatic, adLockOptimistic
t = 0
If rb.EOF = False And rb.BOF = False Then
rb.MoveFirst
t = 0
Else
t = 0
End If
While rb.EOF = False And rb.BOF = False And t = 0
If temp2 = rb("商品编码") Then
temp5 = temp5 + rb("商品数量")
temp6 = temp6 + rb("商品总价")
rg.Open "update 单笔销售信息存储 set 商品数量 = " & temp5 & ",商品总价=" & temp6 & "where 商品编码 ='" & temp2 & "'", db, adOpenStatic, adLockOpti
mistic
t = 1
End If
rb.MoveNext
Wend
If t = 0 Then
rg.Open "insert into 单笔销售信息存储 values ('" & temp2 & "','" & temp3 & "'," & temp5 & "," & temp4 & "," & temp6 & ")", db, adOpenStatic, adLockOptimistic
End If
rb.Close
Next i
[