Skip navigation links

MySQL Forums :: Stored Procedures :: stored variable works in phpmyadmin but not in asp page


Advanced Search

stored variable works in phpmyadmin but not in asp page
Posted by: Johan Arvidsson ()
Date: July 15, 2011 06:05AM

Hello,

I am quite new to mySQL so I hope this is easy for you to help me with.

I have written the following code that inserts a record, then saves the LAST_INSERT_ID() value to @PrenId and updates the record again:
insert into db1017731_nyhetsbrev.Prenumeranter (Pren_Namn, Pren_Epost) values ('TestNamn','TestEpost'); 
set @PrenId := LAST_INSERT_ID(); 
UPDATE db1017731_nyhetsbrev.Prenumeranter SET Pren_kod=encrypt(@PrenId) WHERE Pren_id=@PrenId;

This works fine in phpMyAdmin but when I run it within asp-code on a web server I get the error:

[MySQL][ODBC 3.51 Driver][mysqld-5.0.51a-community]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 '; set @PrenId := LAST_INSERT_ID(); UPDATE db1017731_nyhetsbrev.Prenumeranter SET' at line 1

Does anyone know what to do to make it work on asp page as well as writing the query in phpMyAdmin?

Thanks,

Johan

Options: ReplyQuote


Subject Views Written By Posted
stored variable works in phpmyadmin but not in asp page 1033 Johan Arvidsson 07/15/2011 06:05AM
Re: stored variable works in phpmyadmin but not in asp page 449 Peter Brawley 07/15/2011 06:46AM
Re: stored variable works in phpmyadmin but not in asp page 426 Johan Arvidsson 07/15/2011 07:09AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.