Hello. I have DB with some tables in SQL server 2012. I want manage this tables via datagridviews in winforms app which i created in VS2013. I binded datagridviews to my tables via table adapters, but when i create new rows in datagridview i must automatically
set unique ID for ID-column, because it is not accept null or duplicate values, and user should not think about ID. At first i tried make ID-column identity, because in this case SQL Server automatically set new IDs for new rows. But Identity column cannot
be updated, and datagridview cannot send null-values or duplicated values, so its not helped me. Then i decided manage IDs by myself, by using GetMaxID method, which i created via wizard in VS studio. This method get maximum ID in ID-column: select max(ID)
from MyTable. So now i have enough information to make new IDs, but its not very comfortably count user-created rows and summ it with GetMaxID.
So my questions:
1. How peoples usually manage ID in tables?
2. Is it good use MAX if i have millions rows?
3. Can datagridview automatically manage ID?
4. Can SQL-server automatically create IDs if i will insert rows without ID?
P.S. ID-columns is Primary Key.
So my questions:
1. How peoples usually manage ID in tables?
2. Is it good use MAX if i have millions rows?
3. Can datagridview automatically manage ID?
4. Can SQL-server automatically create IDs if i will insert rows without ID?
P.S. ID-columns is Primary Key.