Point ADO.Net DataSet to different databases at runtime?(在运行时将 ADO.Net DataSet 指向不同的数据库?)
问题描述
我有一个大型 ADO.Net 数据集和两个具有不同约束的数据库模式 (Oracle).数据集将适用于任一模式,但我希望能够在运行时告诉数据集使用哪个模式(通过连接字符串).
I have a large ADO.Net dataset and two database schemas (Oracle) with different constraints. The dataset will work with either schema, but I want to be able to tell the dataset which schema to use (via connection string) at runtime.
这可能吗?
推荐答案
在 .Net 2.0 世界中,您可以在运行时更改表适配器上的连接字符串.您只需确保 Connnection 属性是公开的,可以从数据集设计器中设置.
In the .Net 2.0 world, you can change your connection string on your table adapters at run-time. You just have to be sure the Connnection property is public, which can be set from the dataset designer.
这篇关于在运行时将 ADO.Net DataSet 指向不同的数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在运行时将 ADO.Net DataSet 指向不同的数据库?


基础教程推荐
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01