hi,

> How would I get the MySQL last_insert_id() value into an integer
> variable inside gambas?
>
> I tried with
>
> CurrentID=db.exec("select last_insert_id() as last")
>
> but I get a type mismatch error.  Expecting integer, got result.
>
> Thanks,
>
> Keith
>

i suppose CurrentID is an integer?
you get that error because you actually want to stuff a Result object 
(the return value of DB.Exec()) into an integer (CurrentID as i 
guessed). to get the desired value you should use the returned Result 
object like this:

CurrentID = DB.Exec("select last_insert_id() as last")["last"]

which will get you the value of field "last" in the Result.
see the doc for details.

regards,
tobi

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to