Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Sudden Data Exception Error with MS Xsds - multi-user problem?
 

Sudden Data Exception Error with MS Xsds - multi-user problem?

I have a vb winforms program (Visual Studio 2005).  Among other things the program inserts to a table with an identity field as the primary key.   For the sake of speed of development, I'm using an XSD for the inserts. (Just drag the table from the server explorer, create a data manager class that inherits from the Xsd, and then use the default Insert sql generated.  In this case however, there are no updates, just inserts.  I'm well aware this is not the most efficient technique but only small numbers of records are involved.)

This has worked fine for months.  Now suddenly there have been several data exception errors (apparently when multiple users are adding)  Message = "Column 'Id Key' is constrained to be unique.  Value '4060718' is already present'.  The insert sql does not even reference the Id Key field.  I'm wondering if removing the default Update sql would help, since it will never be needed. 

Or is this some other sort of multi-user problem I have not anticipated?

B. Chernick  Tuesday, October 06, 2009 8:13 PM
> The insert sql does not even reference the Id Key field.

If you are sure of that, then I would check the database to find out how the Id Key is getting set (since it is not coming from the INSERT statement).  Perhaps it is coming from a trigger in the database that has a bug.  If you need help debugging the trigger, and this is for Microsoft SQL Server, post that question to the T-SQL forum here: http://social.msdn.microsoft.com/Forums/en-US/transactsql/threads
BinaryCoder  Tuesday, October 06, 2009 10:47 PM

I neglected to mention that the Id Key field is a plain identity field. 

I should also clarify what I said earlier.  The code just adds new records to a data table which is then passed to the table adapter update statement.  Not elegant, just quick to code.  Granted I said 'small number of records' but now that heavy testing is in progress it's small number of records constantly with several people using the program at once.   As I said earlier, could I be overlooking some multiuser problem?  It's still very intermittent.

(Actually, since you mention it, there was an insert trigger on the table.  For now it has been removed.)

Thanks.

B. Chernick  Wednesday, October 07, 2009 5:35 PM

You can use google to search for other answers

Custom Search

More Threads

• Data Manipulation in DataGridView
• DataGridView Navigator Toolbar
• Programmatically add a row to a dataset table with IDENTITY column
• VB.NET-BindingSource/DataGridView
• When leaving datagrid cell bu pressing enter
• Gridview - sorting
• Need to Export several SQL Server Queries results to Excel
• Datagrid C# question.
• Link or sharing BindingSources between forms
• Best approach for loading and handling file info in a Datagridview