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?
|