views:

167

answers:

3

Hi guys !

I'm having problems with my project once again :(

The front end is C#

I need to support multiline querying like MS SQL server and when these queries are executed, naturally there are going to be multiple result sets.

Getting the datatables respective to the results is not a problem, but how do i make it appear like its done in MS SQL server. One result set below the other and with a scroll bar?

Should i bind it to a datagrid? If so how can i bind multiple tables to a datagrid ? and will it generate the scrollbars and the columns automatically?

If i am not clear, please let me know and i'll try to be more clearer.

ps: If anyone knows how this can be done with the XtraGridControl in devexpress that would be awesome ! :D

+3  A: 

Hi,

you can set a panel with scroll bars on your form and add programatically number of datagrid depend of number of data source. Just add datagrid control to the defined panel.

Xstahef
yes i did think of that. But there should be a better way to do it. This doesnt seem like the right way to me .
Skun
@Skun: This is the best way to do it.
Gabriel McAdams
+2  A: 

SQL Management studio doesn't display all the results in a single grid unless it's a UNION query. Appending multiple grids to a single scrollable pane is the right way to do it, unless you want to break them off into individual tabs.

Brendon
Yes i know that. What i mean is HOW to Append multiple grids to a single scrollable pane?! Please help.
Skun
Just create a new Grid at runtime (GridControl myGrid = new GridControl()), and assign it to your Panel's Control's collection.
Brendon
+2  A: 

The control you probably want is System.Windows.Forms.FlowLayoutPanel (see FlowLayoutPanel@msdn)

It is available from .NET v2 and greater.

flowLayoutPanel1.FlowDirection = FlowDirection.TopDown;
....
// for each result...
flowLayoutPanel1.Controls.Add(newGrid);

I have used it before to achieve a similar effect. I have not however tried to re-size the items within it, they were fixed in height (re-sized width-wise to fit the parent).

You should be able to create each XtraGridControl instance with the required data and add it to the controls as above.

PK :-)

Paul Kohler
Let me try this ! Hope it works ! :( As of now, if i have 'n' grids to display, i'm docking n-1 grids to top and the nth grid as fill. That too fails me :(
Skun
No doesnt work :( Only 2 grids go top to bottom and then the 3rd grid starts of from beside the 1st one ! :(
Skun
Try messing around with the `Width` of the grids. From memory we watched the re-size event on the child and then arranged depending on the parent.ClientWidth...
Paul Kohler
BTW, I just did this with tabs... see http://minisqlquery.codeplex.com/ - text only is next on my list - I find the multiple grids a bit messy if more than about 3...
Paul Kohler
hmmm.. Interesting ! :D Let me look into it and 'll get back ! :D Well, since you've helped me so much :) The boounty is yours ! :D YAY !
Skun
No worries - good luck with the app! PK :-)
Paul Kohler