Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server ASP
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SQL Server ASP Discussions about ASP programming with Microsoft's SQL Server. For more ASP forums, see the ASP forum category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server ASP section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 31st, 2007, 05:11 AM
Authorized User
Join Date: Aug 2007
Location: Pune, Maharshtra, India.
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default Inserting duplicate values in primary key column,

My application wants user to register himself on the first page.This first page will store Company Information.I have a table named master in which CompanyId filed is the primary key. Its data type is Identity...so it generates company id for me. After the company-id page, I am redirecting the user to employee information.To maintain employee info, I have a table that hav companyid field and employee-id field along with his other details. Now everythin is workin fine except one thing...When I insert employee information for the first time, it works fine as the employee info for company-id one gets stored in employee table generating employee-id 1,2,3 and so on for company-id 1. But as soon as try to insert employee information for company-id 2, it gives me error..because I am tryin to insert employee-id 1,2,3...again for company-id 2.This gives error as employee-id is primary key.

How shud i resolve this problem? I know may be some combination concept wud be the solution.But how to implement that? I dont know what shud be the combination and how to put that in my asp??

Can neone help?
Reply With Quote
  #2 (permalink)  
Old August 31st, 2007, 05:38 AM
Authorized User
Join Date: Aug 2007
Location: Pune, Maharshtra, India.
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts

I got the solution...I made primary key a combination of companyid and empid in employee table.

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Determining Which Column is Primary Key 1kHz SQL Language 4 August 16th, 2010 09:16 AM
allow duplicate values in index key pawatz70 Access 3 November 12th, 2007 07:41 PM
Finding Primary Key Column in Script johnpirkey SQL Server 2000 9 April 26th, 2007 10:06 AM
Duplicate Primary Key donevco Access 7 January 18th, 2007 01:59 PM
Checking for duplicate primary key in Access Indo77 ASP.NET 2.0 Basics 2 November 29th, 2006 12:19 PM

All times are GMT -4. The time now is 07:04 PM.

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