Hi,
If the column in the table is Autogenerated , you need not have to specify it
while specifying the values in the Insert query.
e.g. It can be written like this way :
command.CommandText = "Insert into abc values('" + strabcName + "','','O')";
If you are getting the Database error because of the above insert statement ,please check that the values you are inserting matches to the total no of columns in the table. When you count the value list do not include primary key column into it.
Hi,
I have a database which has a primary key field (integer).
It should be autogenerated on every insert statement.
I am hardcoding it everytime to remove the error that the data supplied is less but the column values are more.
command.CommandText = "Insert into abc values(55,'" + strabcName + "','','O')";
This 55 is the primary key which needs to be hardcoded everytime.
Please help me how can I make it autogenerated everytime