我正在向表中插入两个值,一个来自另一个表,另一个来自表单控件但我收到错误。
sqlstr = "INSERT INTO partylinks ( accountid, partyid ) values(Select max(accountsinfo.accid) FROM accountsinfo,2 )"
cmd = New OleDb.OleDbCommand(sqlstr, con, tra)
cmd.ExecuteNonQuery()
答案 0 :(得分:1)
如果您VALUES
SELECT
语法
尝试:
sqlstr = "INSERT INTO partylinks (accountid, partyid) Select max(accountsinfo.accid),2 AS partyid FROM accountsinfo"