在运行时将 ADO.Net DataSet 指向不同的数据库? [英] Point ADO.Net DataSet to different databases at runtime?

查看:26
本文介绍了在运行时将 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 指向不同的数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆