开发者

How to achieve multiple grids like the SQL server Results pane

开发者 https://www.devze.com 2022-12-22 13:59 出处:网络
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

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 i开发者_StackOverflowt 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


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.


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 :-)


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消