导入EXCEL到数据表然后根据ID号批量循环运算到另一个表啊
有两个表,表a , ID、姓名、收入金额、时间 表b,ID、姓名、余额,将Excel的数据导入表a后怎么根据ID号和姓名对表b的余额进行计算啊?代码怎么写啊?控件是Adodc、DataGrid,access数据库,公式是 余额=收入金额+余额我是这么错误的写的:代码不报错但数据库也没有反应
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database Password=123456;Data Source=" + App.Path + "\123.mdb;"
Adodc1.RecordSource = "Select ID AS ID ,姓名 AS 姓名,收入金额 AS 收入金额From 月收入表 "
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database Password=123456;Data Source=" + App.Path + "\123.mdb;"
Adodc2.RecordSource = "Select ID AS ID ,姓名 AS 姓名,余额 AS 余额 From 余额表"
Adodc2.Refresh
With Adodc1.Recordset
If Adodc1.Recordset.Fields("ID") = Adodc2.Recordset.Fields("ID") Then
Do While Not Adodc1.Recordset.EOF
.Fields("余额") = .Fields("余额") + Adodc1.Recordset.Fields("收入金额")
.Update
Adodc1.Recordset.MoveNext
Loop
End If
End With
Set DataGrid2.DataSource = Adodc2
End Sub