问题
This question is driving me crazy and I hope you can help. I want to use the following sql for a MySQL-database:
INSERT INTO Prenumeranter (Pren_Namn,Pren_Email) values ('Testing','test@test.com');
UPDATE Prenumeranter SET Pren_kod = encrypt(LAST_INSERT_ID()) WHERE Pren_id = LAST_INSERT_ID();
This code works perfect if I run it in PhpMyAdmin but if I run it on my asp classic page it only gives errors for the LAST_INSERT_ID(). I have tried to rewrite it in different ways, but they all work in PhpMyAdmin but not from the asp page. The error message is:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[MySQL][ODBC 5.1 Driver][mysqld-5.5.30-cll-lve]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UPDATE Prenumeranter SET Pren_kod = encrypt(LAST_INSERT_ID()) WHERE Pren_id = LA' at line 1
/sida.asp, line 122
If I replace the LAST_INSERT_ID with an int value ('85' or something) everything works fine from asp page too so it must be a problem with the LAST_INSERT_ID().
I appreciate all help that can get me back on track...
来源:https://stackoverflow.com/questions/19061238/cant-get-last-insert-id-to-work-from-asp-classic