Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 729199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:46:12+00:00 2026-05-14T06:46:12+00:00

What advice can you give me on how to track down a bug I

  • 0

What advice can you give me on how to track down a bug I have while inserting data into MySQL database with .Net?

The error message is:

MySql.Data.MySqlClient.MySqlException: Duplicate entry '26012' for key 'StockNumber_Number_UNIQUE'

Reviewing of the log proves that StockNumber_Number of 26012 has not been inserted yet.

Products in use.

  • Visual Studio 2008.
  • mysql.data.dll 6.0.4.0.
  • Windows 7 Ultimate 64 bit and Windows 2003 32 bit.
  • Custom built ORM framework (have source code).
  • Importing data from Access 2003 database.

The code works fine for 3000 – 5000 imports.

The record being imported that causes the problem in a full run works fine if just importing by itself. I’ve also seen the error on other records if I sort the data to be imported a different way.

Have tried import with and without transactions.

Have logged the hell out of the system.

The SQL command to create the table:

CREATE TABLE `RareItems_RareItems` (
    `RareItemKey` CHAR(36) NOT NULL PRIMARY KEY, 
    `StockNumber_Text` VARCHAR(7) NOT NULL, 
    `StockNumber_Number` INT NOT NULL AUTO_INCREMENT,  
    UNIQUE INDEX `StockNumber_Number_UNIQUE` (`StockNumber_Number` ASC), 
    `OurPercentage` NUMERIC ,  
    `SellPrice` NUMERIC(19, 2) ,  
    `Author` VARCHAR(250) ,  
    `CatchWord` VARCHAR(250) ,  
    `Title` TEXT ,  
    `Publisher` VARCHAR(250) ,  
    `InternalNote` VARCHAR(250) ,  
    `DateOfPublishing` VARCHAR(250) ,  
    `ExternalNote` LONGTEXT ,  
    `Description` LONGTEXT ,  
    `Scrap` LONGTEXT ,  
    `SuppressionKey` CHAR(36) NOT NULL,  
    `TypeKey` CHAR(36) NOT NULL,  
    `CatalogueStatusKey` CHAR(36) NOT NULL,  
    `CatalogueRevisedDate` DATETIME ,  
    `CatalogueRevisedByKey` CHAR(36) NOT NULL,  
    `CatalogueToBeRevisedByKey` CHAR(36) NOT NULL,  
    `DontInsure` BIT NOT NULL,  
    `ExtraCosts` NUMERIC(19, 2) ,  
    `IsWebReady` BIT NOT NULL,  
    `LocationKey` CHAR(36) NOT NULL,  
    `LanguageKey` CHAR(36) NOT NULL,  
    `CatalogueDescription` VARCHAR(250) ,  
    `PlacePublished` VARCHAR(250) ,  
    `ToDo` LONGTEXT ,  
    `Headline` VARCHAR(250) ,  
    `DepartmentKey` CHAR(36) NOT NULL,  
    `Temp1` INT ,  
    `Temp2` INT ,  
    `Temp3` VARCHAR(250) ,  
    `Temp4` VARCHAR(250) ,  
    `InternetStatusKey` CHAR(36) NOT NULL,  
    `InternetStatusInfo` LONGTEXT ,  
    `PurchaseKey` CHAR(36) NOT NULL,  
    `ConsignmentKey` CHAR(36) ,  
    `IsSold` BIT NOT NULL,  
    `RowCreated` DATETIME NOT NULL,  
    `RowModified` DATETIME NOT NULL
);

The SQL command and parameters to insert the record:

INSERT INTO `RareItems_RareItems` 
    (`RareItemKey`, `StockNumber_Text`, `StockNumber_Number`, `OurPercentage`, `SellPrice`, `Author`, `CatchWord`, `Title`, `Publisher`, `InternalNote`, `DateOfPublishing`, `ExternalNote`, `Description`, `Scrap`, `SuppressionKey`, `TypeKey`, `CatalogueStatusKey`, `CatalogueRevisedDate`, `CatalogueRevisedByKey`, `CatalogueToBeRevisedByKey`, `DontInsure`, `ExtraCosts`, `IsWebReady`, `LocationKey`, `LanguageKey`, `CatalogueDescription`, `PlacePublished`, `ToDo`, `Headline`, `DepartmentKey`, `Temp1`, `Temp2`, `Temp3`, `Temp4`, `InternetStatusKey`, `InternetStatusInfo`, `PurchaseKey`, `ConsignmentKey`, `IsSold`, `RowCreated`, `RowModified`) 
VALUES
    (@RareItemKey, @StockNumber_Text, @StockNumber_Number, @OurPercentage, @SellPrice, @Author, @CatchWord, @Title, @Publisher, @InternalNote, @DateOfPublishing, @ExternalNote, @Description, @Scrap, @SuppressionKey, @TypeKey, @CatalogueStatusKey, @CatalogueRevisedDate, @CatalogueRevisedByKey, @CatalogueToBeRevisedByKey, @DontInsure, @ExtraCosts, @IsWebReady, @LocationKey, @LanguageKey, @CatalogueDescription, @PlacePublished, @ToDo, @Headline, @DepartmentKey, @Temp1, @Temp2, @Temp3, @Temp4, @InternetStatusKey, @InternetStatusInfo, @PurchaseKey, @ConsignmentKey, @IsSold, @RowCreated, @RowModified)

@RareItemKey = 0b625bd6-776d-43d6-9405-e97159d172a6
@StockNumber_Text = 199305
@StockNumber_Number = 26012
@OurPercentage = 22.5
@SellPrice = 1250
@Author = SPARRMAN, Anders.
@CatchWord = COOK: SECOND VOYAGE
@Title = A Voyage Round the World with Captain James Cook in H.M.S. Resolution… Introduction and notes by Owen Rutter, wood engravings by Peter Barker-Mill.
@Publisher = 
@InternalNote = 
@DateOfPublishing = 1944
@ExternalNote = The first English translation of Sparrman’s narrative, which had originally     been published in Sweden in 1802-1818, and the only complete version of his account to appear in English. The eighteenth-century translation had appeared some time before the Swedish publication of the final sections of his account. Sparrman’s observant and well-written narrative of the second voyage contains much that appears nowhere else, emphasising naturally his interests in medicine, health, and natural history.<br><br>One of 350 numbered copies: a handsomely produced and beautifully illustrated work.
@Description = Small folio, wood-engravings in the text; original olive glazed cloth, top edges gilt, a very good copy. London, Golden Cockerel Press, 1944.
@Scrap = 
@SuppressionKey = 00000000-0000-0000-0000-000000000000
@TypeKey = 93f58155-7471-46ad-84c5-262ab9dd37e8
@CatalogueStatusKey = 00000000-0000-0000-0000-000000000003
@CatalogueRevisedDate = 
@CatalogueRevisedByKey = c4f6fc06-956d-44c4-b393-0d5462cbffec
@CatalogueToBeRevisedByKey = 00000000-0000-0000-0000-000000000000
@DontInsure = False
@ExtraCosts = 
@IsWebReady = False
@LocationKey = 00000000-0000-0000-0000-000000000000
@LanguageKey = 00000000-0000-0000-0000-000000000000
@CatalogueDescription = 
@PlacePublished = Golden Cockerel Press
@ToDo = 
@Headline = 
@DepartmentKey = 529578a3-9189-40de-b656-eef9039d00b8
@Temp1 = 
@Temp2 = 
@Temp3 = 
@Temp4 = v
@InternetStatusKey = 00000000-0000-0000-0000-000000000000
@InternetStatusInfo = 
@PurchaseKey = 00000000-0000-0000-0000-000000000000
@ConsignmentKey = 
@IsSold = True
@RowCreated = 8/04/2010 8:49:16 PM
@RowModified = 8/04/2010 8:49:16 PM

Suggestions on what is causing the error and/or how to track down what is causing the problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T06:46:13+00:00Added an answer on May 14, 2026 at 6:46 am

    Apologies, I’m a MSSQL bod so maybe off the mark here but why are you inserting StockNumber_Number as part of your insert. Its an auto_increment field so surely will be created for you.

    Either drop this field from your insert or don’t make it an auto_increment and the problem should go away.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anybody give me a little advice please? I have a string, for example
can anyone give me any advice on what to do about this error ?!
Can you advice me good php ajax and mysql data grid. It is supposed
Can you give me any general advice on how to debug ASP.NET MVC Binding?
Can anyone give advice, or point to any guides, on how to manage a
Can someone give me some advice on this? I am reading in an old
Can you advice me good free ASP.NET engine for E-commerce?
Can someone advice me how to prevent this error. An item with the same
I have been following the ASP.Net Movie Database Tutorial , and it was all
I hope someone can give me an advice about how to do the following:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.