Dim d As Date = Date.Today
Dim cmd As new SQLCommand
cmd.C
If Tables("pl_Table1").Filter > "" Then
Dim Val As Integer
If InputValue(Val, "缴费金额", "请输入缴费金额:") Then
For Each r As Row In Tables("pl_table1").Rows
cmd.CommandText = "Insert into {xlh} (户号,姓名,身份证号,合作医疗证号,参合时间,缴费金额) Select{hkxx}.户号,姓名,身份证号,{ylz}.医疗证号,\'" & d & "\',\'" & val & "\' from {hkxx} INNER JOIN {ylz} ON {hkxx}.户号 = {ylz}.户号 where r.Checked=true " & Tables("pl_Table1").Filter.replace("户号","{hkxx}.户号")
Else
cmd.CommandText = "Insert into {xlh} (户号,姓名,身份证号,合作医疗证号,参合时间,缴费金额) select {hkxx}.户号,姓名,身份证号,医疗证号,\'" & d & "\',\'" & val & "\' from {hkxx} INNER JOIN {ylz} ON {hkxx}.户号 = {ylz}.户号 where r.Checked =true "
End If
End If
Next
cmd.ExecuteNonQuery
运行这段代码出错。我的主要上的是想让表中checkbox选中的记录才插入到数据库中