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 <(E-Mail Removed)>
> 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
> Date: Mon, 08 Oct 2007 16:25:05 -0000
>
> 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
> On Oct 8, 8:45 pm, sirinath <sirinath19...@gmail.com> wrote:
> > 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(tagDBPARAM*
S
> > 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
>
|