On Tue, 2012-07-17 at 04:14 -0700, Bill-Lancaster wrote:
> I have a table (editprojects) with "id" as primary key, serial, integer.
> There is only one record at the moment (id = 1)
>      hResult = hConn.Exec("SELECT last_insert_id() as id FROM editprojects")
> print hResult!id
> produces 0 not 1
> 
> Obviously my sql query is at fault but where?
> 
> I wonder if anyone can help.
Bill,
AFAIK in mysql last_insert_id is session and connection based, from the
limited info you give, it looks like you are trying to get the last
insert id outside a session or connection.
If so you could try "SELECT MAX(id) as last_insert_id FROM
editprojects".  If not, then a short trip down the web history of this
totally bungled concept from mysql....

Bruce


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to