开发者

Getting last insert id in Excel ADODB connection to MySQL database

开发者 https://www.devze.com 2022-12-20 00:17 出处:网络
I have the开发者_Python百科 following code to insert items into a MySQL database from an Excel form.

I have the开发者_Python百科 following code to insert items into a MySQL database from an Excel form.

Set rs = New ADODB.Recordset
ConnectDB
With wsWorkBook
    strSQL = "INSERT INTO work_order (job_status, job_description, system_id) VALUES ....;"
    rs.Open strSQL, oConn, adOpenDynamic, adLockOptimistic
    ' word_order.id
End With

How can I get the last insert id of that line, which is in the work_order.id column?


Try using the LAST_INSERT_ID() - operator in a following SQL-Statement:

SELECT LAST_INSERT_ID();
0

精彩评论

暂无评论...
验证码 换一张
取 消