Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey I have work with c# and Sql server for awhile but never had to build anything from start-up. I created a database with basic stored procedure. insert, update, and delete basic stuff.


ok.. here we go.
tb1
pid int indentity (1,1) pk
projectname
tb2
sid int indentity (1,1) pk
pid int fk
systemnumbers
tb3
cid int indentity (1,1) pk
pid int fk
sid int fk
cname
caddress
ccity
cstate
czip


I have a problem with duplicate records on these two tables tb1 and tb2. These tables are the system number and project name. Every web form has two drop down list that is populate with data from tb1 = projectnames and tb2 = systemnumber.

When they click the save button the data is save but, tb1 has a new entry with duplicate projectname and tb2 has a duplicate with systemnumber each receives a new pk number.

I tried validation check if exist get error can't modified existing pk.
or doesn't save.

I have pk and fk on each table connected to tb1 and tb2.

any help any one can give is appreciated.

If I can get example code a link to reference(any thing) :( :confused: :((

So if I have a data in tb1 pid 1 projectname bike.
On the form when you enter a new client with the tb1 as ddl projectname bike which connects them to the bike project. It saves the data yet, when I refresh the ddl bike is listed twice with a new pid number of 2. When I repeat bike is on the ddl list a third time with pid number 3 and so on.

This is happen with tb2 as well.



I hoping this is a better explanation to my problem.

Thanks alot for your help.
Posted
Updated 1-Sep-10 6:05am
v3

1 solution

I don't really understand what you're asking.

Each table has its own identifier column that's set up as the primary key for that table. If you want to prevent dupliccate info in the 2nd table, your have to design your database in such a way as to setup relationships using the identifier columns in the related tables, and only add the columns that are applicable to the tables.

You don't appear to have duplicate records - you appear to be talking about duplicate info in the related tables.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900