In this case, access can be used, but SQL does not work. In Baidu's search solution, we found that N people encountered the same problem but could not find a solution:
CopyCodeThe Code is as follows: Set rs = server. Createobject ("ADODB. recordset ")
Rs. Open "select * from T1", Conn, 1, 3
Rs. addnew ()
RS ("data") = "ABC123"
Rs. Update
RS ("data") = RS ("ID ")
Rs. Update
Rs. Close
Conn. Close
(Note: The ID field is the ID value (Identity )))
In a SQL database, you can only use the following methods:Copy codeThe Code is as follows: dim newid
Set rs = server. Createobject ("ADODB. recordset ")
Rs. Open "select * from T1", Conn, 1, 3
Rs. addnew ()
RS ("data") = "ABC123"
Rs. Update
Newid = RS ("ID ")
'Note that the value of the identifier must be 1 in cursortype and must be updated ().
Rs. Close
Rs. Open "select * from T1 where id =" & newid, Conn, 1, 3
RS ("data") = newid
Rs. Update
Rs. Close
Conn. Close