Auto increment issue with tableadapter insert

Posted on 2006-03-21
Last Modified: 2013-12-25
I have a tableadapter insert that inserts the data into my database,but I need to specify in the record number in the insert command. How do I code this for an auto incrementing value?, as I cannot leave it as nothing on the insert.


Question by:bradbritton
    LVL 4

    Expert Comment

    what kind of database are you updating?

    Author Comment

    MS SQL 2005 database
    LVL 15

    Accepted Solution

    You have to set the field in MS SQL as data type INT and check the Identity column as this will tell MS SQL that this field is an auto incrementer. Then you do not need to include that field in your insert statement.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
    Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now