Can't get LAST_INSERT_ID() to work from ASP classic

孤人 提交于 2021-02-11 14:17:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!