如何实现像 SQL Server 结果窗格一样的多个网格

发布于 2024-08-24 00:16:59 字数 309 浏览 3 评论 0原文

我的项目再次遇到问题:(

前端是 C#

我需要支持像 MS SQL Server 一样的多行查询,当这些查询执行时,自然会有多个结果集。

获取相应的数据表结果不是问题,但我如何使其看起来像在 MS SQL 服务器中完成的那样。一个结果集位于另一个结果集下方并带有滚动条,

我应该将其绑定到数据网格吗?多个表到数据网格?它会自动生成滚动条和列吗?

如果我不清楚,请告诉我,我会尽力更清楚。

ps:如果有人知道这是怎么回事。使用 devexpress 中的 XtraGridControl 完成,那就太棒了:D

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

煮酒 2024-08-31 00:16:59

您可以在表单上设置一个带有滚动条的面板,并根据数据源的数量以编程方式添加数据网格的数量。只需将 datagrid 控件添加到定义的面板即可。

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.

西瓜 2024-08-31 00:16:59

您可能需要的控件是 System.Windows.Forms.FlowLayoutPanel (请参阅FlowLayoutPanel@msdn)

它可从 .NET v2 及更高版本获得。

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

我以前也用过它,达到了类似的效果。然而,我没有尝试重新调整其中项目的大小,它们的高度是固定的(调整宽度方向的大小以适合父级)。

您应该能够使用所需数据创建每个 XtraGridControl 实例,并将其添加到上述控件中。

PK:-)

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

山色无中 2024-08-31 00:16:59

SQL Management studio 不会在单个网格中显示所有结果,除非它是 UNION 查询。将多个网格附加到单个可滚动窗格是正确的方法,除非您想将它们分成单独的选项卡。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文