Go to Post Don't let your FIRST blinders prevent you from thinking. - JaneYoung [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 07-06-2007, 03:18
i2ppl i2ppl is offline
Registered User
no team
 
Join Date: Jun 2007
Location: Uzbekistan
Posts: 1
i2ppl is an unknown quantity at this point
Can i output combined query to DBGrid or DBEhlibGrid

Hello friends!
I need your help in this case.

I've 2 tables: table1(id, id_bookname) and table2(id, id_bookname, bookname).

table1's `id_bookname` consists table2's integer `id_bookname`'s values.

Can i output combined query to DBGrid or DBEhlibGrid which contains table1's `id` and table2's `bookname`.

For instanse,

table1
id id_bookname
------------------------------
1 134
2 532
3 134
4 134
5 532

table2
id id_bookname bookname
-----------------------------------------------------
1 134 book1
2 532 book2

Results in DBGrid must be:
id bookname
---------------------------
1 book1
2 book2
3 book1
4 book1
5 book2
  #2   Spotlight this post!  
Unread 07-06-2007, 15:43
MattD's Avatar
MattD MattD is offline
Registered User
AKA: Matthew Douglas
FRC #0228 (GUS Robotics)
Team Role: Alumni
 
Join Date: Feb 2006
Rookie Year: 2005
Location: Indianapolis, IN
Posts: 185
MattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to behold
Send a message via AIM to MattD
Re: Can i output combined query to DBGrid or DBEhlibGrid

You can probably do a query such as this:
Code:
SELECT table1.id,table2.bookname FROM table1,table2 WHERE table1.id_bookname=table2.id_bookname
I don't know much about the DBGrid thing, though.
__________________
GUS Robotics Team 228

2010 WPI Engineering Inspiration Award
2010 WPI Regional Champions (Thanks 230 & 20!)
2010 CT VEX Champions
2010 CT VEX Innovate Award
2009 QCC VEX Champions
2009 CT Motorola Quality Award
2007 CT J&J Sportsmanship Award
2006 CT Best Website Award
  #3   Spotlight this post!  
Unread 07-06-2007, 23:13
Scott L.'s Avatar
Scott L. Scott L. is offline
Registered User
FRC #0222 (Tigertrons)
Team Role: Engineer
 
Join Date: Sep 2003
Rookie Year: 1998
Location: Tunkhannock PA
Posts: 290
Scott L. is just really niceScott L. is just really niceScott L. is just really niceScott L. is just really niceScott L. is just really nice
Send a message via AIM to Scott L.
Lightbulb Re: Can i output combined query to DBGrid or DBEhlibGrid

Are you Using SQL? Also are you trying to display the results in an ASP.Net Page using Visual Studios? or just in SQL, if using SQL.

If just in SQL the query by MattD should work.
If in ASP.Net using visual studios, under the data category drag the sql data source into the design view, hover the mouse over the new control and select the arrow in the upper right corner, select configure data source, create the connection string, then click next. Next select custom query, then paste MattD's query into the feild. click next, finish
Next on the design veiw drag the gridveiw onto the screen where u placed the last control. select the configure datasource as you did for the previous control, select datasource1, or create new if not there. That should be it. to veiw results, click veiw in browser in the menubar on the top of the page.
__________________
You can do anything, if you put your mind to it!!!
http://asp.shinraikon.com
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculus Query phrontist Math and Science 36 01-11-2005 20:24
Delhpi Program Query sunil bansal Programming 4 04-02-2005 00:22
Member Query Tytus Gerrish CD Forum Support 9 02-12-2003 20:09
MySQL query question Jack Website Design/Showcase 9 02-02-2003 00:11
Can I drill the output shafts of unmodifiable motors? archiver 2001 4 23-06-2002 23:08


All times are GMT -5. The time now is 09:32.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi