Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 PK and FK issues

Author  Topic 

FloatingPoint
Starting Member

1 Post

Posted - 2008-10-20 : 08:04:17
Hello,

I’m real new to database and SQL Server 2005 and I’m having problems getting two tables two work together; Sites and Contacts see below. I’m using Visual Studio 2008 (VB.NET) and ASPxGridView from Developer Express.

INSERT INTO [stinkit2].[dbo].[Contacts]
([SitesID]
,[FName]
,[LName]
,[Phone]
,[Pager]
,[CellPhone]
,[TLA]
,[AFN]
,[FN])
VALUES
(<SitesID, int,>
,<FName, varchar(25),>
,<LName, varchar(25),>
,<Phone, varchar(12),>
,<Pager, varchar(12),>
,<CellPhone, varchar(12),>
,<TLA, varchar(2),>
,<AFN, nvarchar(3),>
,<FN, nvarchar(2),>)

The SitesID is the PK in the Sites Table and SitesID is the FK in the Contacts table. However, the (FN) field is the field that each table is called by. Meaning the table Sites(FN) would have a FN number value, say 80 and the Contacts that are FN 80 would match when you select Sites FN 80, therefore all of the contacts for Sites FN would match.

Any idea what I'm doing wrong? Thanks.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-20 : 08:10:55
your problem is still unclear. can you illustrate what you're facing with some sample data?
Go to Top of Page
   

- Advertisement -