以下编制银行明细与分类明细自动核对并添加相关信息的代码,想法是如果两张表在具有相关数量的某一借方金额,则把分类明细中的凭证编号和出纳编号填写到相关的银行明细中,但是执行到黄色代码时提示错误如下:
无法将类型为“System.Collections.Generic.List`1[System.String]”的对象强制转换为类型“System.Collections.Generic.List`1[System.Double]”
Dim khyhs As List (of String) = DataTables("银行明细").GetValues("开户银行")
msgbox(1)
For Each khyh As String In khyhs
msgbox(2)
Dim yhjifas As List (of Double) = DataTables("银行明细").GetValues("借方金额","开户银行 = '"& khyh & "'")
Dim fljifas As List (of Double) = DataTables("分类明细").GetValues("借方金额","开户银行 = '"& khyh & "'")
msgbox(3)
For Each yhjifa As Double In yhjifas
Dim yhjfs As List (of DataRow) = DataTables("银行明细").SQLCompute("借方金额 = '"& yhjifa & "'")
Dim fljfs As List (of DataRow) = DataTables("分类明细").SQLCompute("借方金额 = '"& yhjifa & "'")
If yhjfs.Count = fljfs.Count Then
For n As Integer = 0 To yhjfs.count - 1
yhjfs(n)("凭证编号") = fljfs(n)("凭证编号")
yhjfs(n)("出纳编号") = fljfs(n)("出纳编号")
Next
End If
Next
Next