DataProcessor + Connector .NET, Inserted ID


I can see that others have had problems with this as well but not how they solved the problem, so I will ask the question again.

I have a dhtmlxGrid with an attached DataProcessor and I have a .NET Connector - so far things are working more or less as expected, but, the Connector is using custom statements (select, update, insert, delete) because it has to add a few extra attributes to the statement before they are executed.

Now, the problem is to get the actual ID of the inserted row from the database (which has an auto-increment/identity column named “Id”).
A new row in the grid gets it’s ID from new Date().valueOf() which of cause isn’t the value that the database will assign to the new row.

So how do I find the new ID of the inserted row so it can be updated correctly back to the grid?

Really, still nobody knows this?

the insert query is expected to return new id, so adding ‘select SCOPE_IDENTITY()’ after the insert should do:[code]var connector = new dhtmlxGridConnector(
“SELECT ISO, PrintableName FROM Country”,

connector.Request.CustomSQLs.Add(CustomSQLType.Insert, @“INSERT INTO Country (PrintableName, Name, ISO) VALUES (’{PrintableName}’, ‘{PrintableName}’, ‘{ISO}’); SELECT SCOPE_IDENTITY();”);[/code]

Thanks, that seems to do the job… This ought to be in the documentation for custom statements.