如何从 C# 的 sql server 2005 中的 datagridview 记录创建临时表

发布于 2024-12-13 01:12:32 字数 139 浏览 4 评论 0原文

我正在 C# .Net Framework 3.5 中处理 winforms。

我有一个包含一些记录的 datagridview,我想创建一个包含 datagridview 数据的临时表,此控件未绑定到任何数据表或数据集。用户将手动在其中输入记录。

i am working on winforms in C# .Net Framework 3.5.

i have a datagridview with some records, i want to create a temporary table with data of datagridview this control is not bound to any data table or dataset. user will manually enters record in it.

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

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

发布评论

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

评论(1

西瑶 2024-12-20 01:12:32

听起来您应该在 SQL Server 中创建一个View,其中包含所有城市的所有记录。

然后,您可以从应用程序 (C#) 创建查询,该查询根据单个选定的城市过滤表。

SQL Server 提供查询缓存,因此如果多次查询同一城市,您将看到性能提升。

视图和查询的组合本质上就是您正在寻找的“临时表”。请注意不要将其与 SQL Server 临时表CTE

It sounds like you should be creating a View in SQL Server, which contains all records for all cities.

Then, you can create queries from your application (C#) which filter the table based on a single, selected City.

SQL Server provides caching of queries, so you will see a performance lift if the same city is queried multiple times.

The combination of your View and your query are, in essence, the 'temporary table' you are looking for. Be careful not to confuse this with SQL Server temporary tables or CTE's.

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