Why can odbc not do two querys?
Looking for another method to my previous posts: MySql and inserting last ID problem remains
and
开发者_如何学GoMySQL connection error that I have never seen
Im trying to come up with other ways to get the UserID after an insert statement but im falling short.
I refuse to beilieve some one wrote the odbc without thinking "wait a minute what if some one wants to execute two querys" I mean its been around for ages?
Or maybe its not so much two querys but getting the last inserted query back, this may be a short fall from c#...
My only other option would be to place all my textboxes in some kind of container along with the button and when the button is clicked I use my first insert statement and set that container visibile = false. and have a second container below it which was initialy invisible but after the first button click set it to visible with the new fileupload control and new button for a new insert, but that wont solve the issue of how to get the userid after its been inserted without a session? And there is no session without being authenticated.
I tagged javascript in this as Im not sure if there is anything a second code could help with?
From the documentation of the MySQL ODBC connector:
FLAG_MULTI_STATEMENTS
Allow multiple statements Enables support for batched statements. This option was added in Connector/ODBC 3.51.18.
So make sure you install Connector version 3.51.18 or newer, then enable the multi-statement flag before running your batch by specifying option=67108864
in the connection string .
I think that you're looking for the LAST_INSERT_ID() function. Check out the documentation here.
Share and enjoy.
精彩评论