How to add identity column to datatable using c#

前端 未结 6 1204
逝去的感伤
逝去的感伤 2020-12-16 18:37

How to add identity column to datatable using c#. Im using Sql compact server.

6条回答
  •  春和景丽
    2020-12-16 19:35

    You don't do autoincrement on DataTable (or front-end for that matter), unless you want to make your application a single user application only.

    If you need the autoincrement, just do it in database, then retrieve the autoincremented id produced from database to your front-end.

    See my answer here, just change the SqliteDataAdapter to SqlDataAdapter, SqliteConnection to SqlConnection, etc : anyway see why I get this "Concurrency Violation" in these few lines of code??? Concurrency violation: the UpdateCommand affected 0 of the expected 1 records

提交回复
热议问题