如何从 C# 的 sql server 2005 中的 datagridview 记录创建临时表
我正在 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来您应该在 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.