I see it’s been asked before but I too am having problems with auto-increment fields and the grid updating the new ID after insert.
Generating an id keeps the id in the grid until refreshed thus causing updates after the fact to fail since the ID does not match the one generated by the database.
Past forum responses just indicate that the new row id should auto-magically be set after the insert is done.
Can someone suggest what I might be doing wrong?
[.Net Connector Code]
dhtmlxGridConnector connector = new dhtmlxGridConnector(
"select [EntryID],[Column1] from TableX",
"EntryID",
dhtmlxDatabaseAdapterType.SqlServer2005,
ConnectionHelper.getSQLConnection()
);
// [EntryID] being the AutoIncrementing field
if (type == ActionType.Inserted)
{
connector.Request.CustomSQLs.Add(CustomSQLType.Insert,
"insert into TableX (Column1) values (' " + Tools.EscapeQueryValue(form[id + "_c0"] + " ')");
}[/code]
[.js Code]
[code]var id = grid.uid(); // generates a number around 1382550707046 (but EntryID generated by SQL will be 1,2,3...
grid.addRow(id, "some value", 0);
// trying to select the row based on the id of '1382550707046' always fails and selecting the
// inserted row and editing it also fails to update the database due to incorrect EntryID values...
Any help/hints/suggestions on how to solve this is much appreciated.
Thanks,
Ray