0

C# database insert query problem

I have built a connection of my C# program with SQL Server. The table in which i am inserting data has a primary key. what should i insert for the primary key as it should be on auto increment.

2nd Jul 2017, 1:29 PM
Haider Ali
Haider Ali - avatar
4 odpowiedzi
+ 1
no need to insert any value for the primary key if it's set (and should be) as auto-increment.
2nd Jul 2017, 1:34 PM
Salekin
Salekin - avatar
0
is it required to set auto increment in SQL Server? because it is marking auto increment as error
2nd Jul 2017, 2:38 PM
Haider Ali
Haider Ali - avatar
0
Can you post your code. I have the feeling that your are trying to fill the primary key when it want to fill the sql server wants to fill it.
3rd Jul 2017, 6:10 PM
sneeze
sneeze - avatar
0
I have resolved the issue. the primary key was not set on auto increment that's what the issue was.
3rd Jul 2017, 6:11 PM
Haider Ali
Haider Ali - avatar