Emuforums.com

Go Back   Emuforums.com > General Discussion > Web development / Programming
About Us Register FAQ Members List Calendar Mark Forums Read

Login to remove all ads!
Reply
 
LinkBack Thread Tools Display Modes
Old May 17th, 2004   #1 (permalink)
The Handsome Man
 
Sampah's Avatar
 
Join Date: Nov 2002
Location: Unlucky Place
Posts: 881
How to join 2 DataTable in a Dataset in VB.NET?

helo, anyone have any idea of how to join two data table through a primary key in a dataset. For more specific, I have a "employee" table and a "user" table in a dataset. Not all employee are users, but user must be employee. Thus, i want only the employee that are users are displayed in the datagrid. I am using VB.Net as my programming language. Thanks in advance.
__________________
PROCESSOR: AMD Athlon 64 3000+ @1.8Ghz RAM: Kingstone 512MB PC3200 MOBO: ECS Nforce4 A939
VGA: Pixelview Geforce 6600GT (Golden Limited Edition) 128MB OS: WinXP pro Service pack 2
Sampah is offline   Reply With Quote
Old May 17th, 2004   #2 (permalink)
Rosen Ritter
 
Badaro's Avatar
 
Join Date: Apr 2001
Location: Brazil
Posts: 3,394
Quote:
Originally Posted by Sampah
helo, anyone have any idea of how to join two data table through a primary key in a dataset. For more specific, I have a "employee" table and a "user" table in a dataset. Not all employee are users, but user must be employee. Thus, i want only the employee that are users are displayed in the datagrid. I am using VB.Net as my programming language. Thanks in advance.
Which database are you using? Because, unless it doesn't support joins, it's probably a better idea to join the tables in the DB.

[]s Badaro
__________________
My old signature became obsolete and I lack imagination to make a new one.

Last edited by Badaro; May 18th, 2004 at 03:18.
Badaro is offline   Reply With Quote
Old May 17th, 2004   #3 (permalink)
Knowledge is the solution
 
Proto's Avatar
 
Join Date: Dec 2002
Location: Mexico City, Mexico
Posts: 5,366
hmmm.... well i havent used .NET but the sql format would be

"select user.*, employee.* from user,employee where user.iduser = employee.theforeignkeyyouareusing
__________________


Proto is offline   Reply With Quote
Old May 17th, 2004   #4 (permalink)
Emu author
 
ammoQ's Avatar
 
Join Date: Mar 2002
Location: Vienna/Austria/Europe
Posts: 1,168
My guess: "select employee.* from user, employee where user.employee_id = employee.id" but it's only slightly different from Proto's attemt.
__________________
If you think my English is bad, wait till you read my Polish.
ammoQ is offline   Reply With Quote
Old May 18th, 2004   #5 (permalink)
The Handsome Man
 
Sampah's Avatar
 
Join Date: Nov 2002
Location: Unlucky Place
Posts: 881
thanks any other idea would be welcome, btw I'm using VB.net.
__________________
PROCESSOR: AMD Athlon 64 3000+ @1.8Ghz RAM: Kingstone 512MB PC3200 MOBO: ECS Nforce4 A939
VGA: Pixelview Geforce 6600GT (Golden Limited Edition) 128MB OS: WinXP pro Service pack 2
Sampah is offline   Reply With Quote
Reply

Thread Tools
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 21:49.

© 2006 - 2008 Emu Forums | About Emu Forums | Legal | A member of the Crowdgather Forum Community


Powered by vBulletin® Version 3.7.0 Release Candidate 3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5