我正在尝试使用SQL语句添加新事务。
数据库: Ms Access
行代码:
sqL = "INSERT INTO TableTransactions VALUES('"
& transno.Text & "','" & cmbmonth.Text & "','" & cmbdate.Text
& "','" & txtCash.Text & "','" & txtLand.Text & "','"
& txtADFee.Text & "','" & txtBuilding.Text & "','"
& txtEquipments.Text & "','" & txtAReceivables.Text
& "','" & txtAPayable.Text & "','" & txtNPayable.Text
& "','" & txtSPayable.Text & "','" & txtTPayable.Text
& "','" & txtCapital.Text & "','" & txtExpenses.Text
& "','" & txtRevenue.Text & "','" & txtDrawings.Text & "')"
错误:
查询和目标文件夹错误数。
答案 0 :(得分:0)
您必须指定字段的顺序:
sqL = "INSERT INTO TableTransactions (FieldNo, FieldMonth, FieldDate, ... etc.) VALUES('"
& transno.Text & "','" & cmbmonth.Text & "','" & cmbdate.Text
& "','" & txtCash.Text & "','" & txtLand.Text & "','"
& txtADFee.Text & "','" & txtBuilding.Text & "','"
& txtEquipments.Text & "','" & txtAReceivables.Text
& "','" & txtAPayable.Text & "','" & txtNPayable.Text
& "','" & txtSPayable.Text & "','" & txtTPayable.Text
& "','" & txtCapital.Text & "','" & txtExpenses.Text
& "','" & txtRevenue.Text & "','" & txtDrawings.Text & "')"
那就是说,请阅读如何使用参数来避免串联模糊并提高安全性。