A first chance exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll

S

sirinath

Hi,

I am getting this exception when I am trying to insert the second item
to an access DB. The values are from another OleDB source.

If there are links about this exception please let me know.

The full exception:

A first chance exception of type 'System.Data.OleDb.OleDbException'
occurred in System.Data.dll
System.Data.OleDb.OleDbException: The changes you requested to the
table were not successful because they would create duplicate values
in the index, primary key, or relationship. Change the data in the
field or fields that contain duplicate data, remove the index, or
redefine the index to permit duplicate entries and try again.
at
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object&
executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior
behavior, Object& executeResult)
at
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
at
PairTraderWindowsApplication.ConfigForm.importCompany(OleDbConnection
conDB, OleDbConnection conImportExcel, String sectorName) in C:
\Documents and Settings\sumindad\My Documents\Visual Studio
2005\Projects\PairTraderWindowsApplication\PairTraderWindowsApplication
\Config.cs:line 226
at PairTraderWindowsApplication.ConfigForm.doImport(Object
dummyObj) in C:\Documents and Settings\sumindad\My Documents\Visual
Studio 2005\Projects\PairTraderWindowsApplication
\PairTraderWindowsApplication\Config.cs:line 132

Best regards, Suminda Sirinath Salpitikorala Dharmasena
 
S

sirinath

Hi,

NB: The PK is an auto number and there are no indexes in the given
table. This fail in the insert of the second item which is different
from the 1st.

Best regards, Suminda Sirinath Salpitikorala Dharmasena
 
C

Chris Alton [MSFT]

Please post the two rows of data you are inserting and the section of code
you are using to do the inserts.
-------------------------------------
Chris Alton, Microsoft Corp.
SQL Server Developer Support Engineer
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: sirinath <[email protected]>
Newsgroups: microsoft.public.data.oledb,microsoft.public.data.ado,microsoft.public.dotne
t.languages.csharp,microsoft.public.dotnet.framework.adonet,microsoft.public
..access
Subject: Re: A first chance exception of type
'System.Data.OleDb.OleDbException' occurred in System.Data.dll
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top