New topic: GetInsertID not working for MySql?
<http://forums.realsoftware.com/viewtopic.php?t=38027> Page 1 of 1 [ 1 post ] Previous topic | Next topic Author Message markwalsh Post subject: GetInsertID not working for MySql?Posted: Wed Mar 09, 2011 6:04 pm Joined: Wed May 20, 2009 4:43 pm Posts: 406 I have a method creating a record, and I'm trying to get the key for the record created. The following is a code snippet: Code: if db <> nil then recordCreated = DBCode_Generic.SQL_Execute (theSQL, db) if recordCreated then if db isa REALSQLDatabase THEN Key = REALSQLDatabase(db).LastRowID elseif db isa MySQLCommunityServer then Key = MySQLCommunityServer(db).GetInsertID end if end if end if 'DBCode_Generic.SQL_Execute' is a generic method to run the SQL to create the record, and it returns a boolean whether the record was created or not. 'db' is the correct database that I am targeting. There are no errors in the SQL Execute, and the record is committed properly to the database. The code progresses to the line where it runs GetInsertID, but the value of Key is 0. Is there something that I am missing here? I have changed the value of db from a generic 'Database' to a specific 'MySQLCommunityServer', and the value is still 0. I'm using 2010 R2.1. Is this one of the database issues that was broken during one of the updates, do I need to use a newer version for this to work? _________________ RB 2009r4 Windows XP Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 1 post ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
