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 指向不同的数据库?
基础教程推荐
- SonarQube C# 分析失败“不是指针的有效行偏移" 2022-01-01
- Mono https webrequest 失败并显示“身份验证或解密失败" 2022-01-01
- 从 C# 控制相机设备 2022-01-01
- 获取C#保存对话框的文件路径 2022-01-01
- 如果条件可以为空 2022-01-01
- 重新排序 WPF TabControl 中的选项卡 2022-01-01
- 在 VB6 或经典 ASP 中使用 .NET 2022-01-01
- 将数据集转换为列表 2022-01-01
- C# 9 新特性——record的相关总结 2023-04-03
- 更新 Visual Studio 中的 DataSet 结构以匹配新的 SQL 数据库结构 2022-01-01
