Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 8th, 2008, 05:20 PM
Registered User
 
Join Date: Sep 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to twyce
Default Violation of PRIMARY KEY constraint???

I am using bulkcopy to import data into SQL server database.The data i'm trying to import contains student numbers and the modules that they are registerd for.A student can be registered for many modules(which means one student number can appear many times on the table).Problem is when i try to import my spradsheet my application throws a "Violation of PRIMARY KEY constraint" error.
How do i fix this?

Twyce!
 
Old September 9th, 2008, 01:23 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Well the simple answer is to either not import records that violate the primary key, or remove or hane the primary key.

You haven't told us what the table looks like, nor what the primary key is so we couldn't tell you more.

/- Sam Judson : Wrox Technical Editor -/





Similar Threads
Thread Thread Starter Forum Replies Last Post
primary key constraint dhoward VB.NET 2002/2003 Basics 7 July 27th, 2007 09:56 AM
Violation of primary key dhoward VB.NET 2002/2003 Basics 4 May 31st, 2007 10:19 AM
Primary Key Violation error code hasanali00 BOOK: ASP.NET Website Programming Problem-Design-Solution 1 April 19th, 2005 07:41 PM
primary key violation muralikeane Classic ASP Databases 8 May 21st, 2004 09:24 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.