StrataFrame Forum

vfp 9.0 autoincrement question & possible solution

http://forum.strataframe.net/Topic10808.aspx

By Marcel Heitlager - 8/10/2007

As pointed out in another post, vfp doesn't support @@identity.  I did some research on this and found that the vfpoledb provider version 9.0 does support "GETAUTOINCVALUE(0);" (version 8 doesn't).  With the 0 parameter it is supposed to provide the exact same functionality as @@identity provided you call executescalar before closing the connection. 

So I added a KeepConnectionOpen protected property to the dbdatasourceitem class.  In the UpdateRow function  I added the line KeepConnectionOpen = True if loCommands(1) exists (we have autoincrementing table).  In the internalexecutenonquery() function of the dbDataSourceItem class I check for that value so it won't allow it to close the connection if we have an autoincrementing field.  After that I set KeepConnectionOpen = False. So far this seems to work.

Is there anything that I might have overlooked? It seems like a simple solution.

Thanks,

Marcel


 

By Trent L. Taylor - 8/13/2007

No.  Thanks for the information.  We have not tested that, so like anything else, you may want to make sure that you do not have any issues when there are multiple-users hitting the file at the same time.  That would be my only caution. Smile