fk name instead id

T

TomislaW

i have two tables one table has fk that is integer when I bind datagrid I
would like to have name and not id.
is it posible with dataset, I mean if I have two tables populated in
dataset (I know that I can do this on database with join two tables, but is
there some kind of join in dataset) ?

sample database:

CREATE TABLE [Table1] (
[id] [int] NOT NULL ,
[name] [varchar] (50)
) ON [PRIMARY]
GO
CREATE TABLE [Table2] (
[tabid] [int] NOT NULL ,
[id] [int] NOT NULL ,
[description] [varchar] (50)
) ON [PRIMARY]
GO
ALTER TABLE [Table1] WITH NOCHECK ADD
CONSTRAINT [PK_Table1] PRIMARY KEY CLUSTERED
(
[id]
) ON [PRIMARY]
GO
ALTER TABLE [Table2] WITH NOCHECK ADD
CONSTRAINT [PK_Table2] PRIMARY KEY CLUSTERED
(
[tabid]
) ON [PRIMARY]
GO
ALTER TABLE [Table2] ADD
CONSTRAINT [FK_Table2_Table1] FOREIGN KEY
(
[id]
) REFERENCES [Table1] (
[id]
)
GO
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top