Inserting into SQL 7.0 with an identity column as the primary key problems RRS feed

  • Question

  • Hi I'm using Visual Web Developer Express 2005 and I'm connecting to a SQL 7.0 database.  The table I'm connecting to is a table where I store help desk issues that I've encountered.  Since I could have tons of help desk issues with multiple instances of the same user, same issue I decided to go with a column called "ID" as the primary key, I was also thinking of using an automatic time stamp but I'd rather use the "autonumber".  "ID"s property is set to Identity.  To select,update,insert and delete I just use the automatic generate statements VWD makes for you.  Select, Delete and update work fine but the insert gives me this error.

    ERROR [23000] [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot insert explicit value for identity column in table 'HelpDesk' when IDENTITY_INSERT is set to OFF.

    Even though it says I'm inserting something into the identity column I am not.  That box isn't available when I'm inserting a new HelpDesk issue.
    I've tried many things I've seen on forums such as:  putting the Identity_insert ON statement in my insert statement, not putting the "ID" column in the insert statement(which works but then it will insert the data into the wrong columns).  Here is the insert statement generated by VWD

    INSERT INTO [HelpDesk] ([ID], [Username], [Issue], [Resolution]) VALUES (?, ?, ?, ?)

    oh, also I don't think I want to use a GUID because that seems like it will be to large for what I'm doing.
    Any suggestions would be appreciated
    Thursday, October 19, 2006 1:30 PM