我想在数据库和加载到相同的数据网格之间进行选择 [英] I want to choose between database and load into same datagrids

查看:61
本文介绍了我想在数据库和加载到相同的数据网格之间进行选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



我希望能够在多个数据库之间进行选择

每个数据库基本上都会有相同的信息部分。

所有的表格和视图都是一样的......他们只会持有

不同的统计数据,但结构相同......就表和视图而言....

所有表和视图都是相同的



目前我有一个构建的数据库..我正在使用vb。 net和Mssql 2008

所以我知道我可以将所有不同的数据库添加到项目中。

然后将数据库拖出表单并且wahlah它产生了我的要求对于....

但这需要很大的空间并且总是与所有东西相连?

我肯定不会是正确的方式...... 。



但我需要能够在数据库之间进行选择,一旦我选择了一个......

它将连接并加载到datagrids我在表格上有...





我以为我可以像树视图或组合框一样进行选择。

然后所有数据网格将被连接到选择的数据库。





是否有任何人对这种类型的场景有任何可能的解决方案



在此先感谢...

Jeff



ps我会提供代码但不确定如何开始。

我对这个主题很弱

Hi All

I want to be able to select between multiple databases
Each database will basically have the same info for the most part.
all the tables and views will be the same...they will just hold
different statistics but with the same structure...as far as tables and views....
all tables and views are Identical

Presently I have a database that is built..and I am using vb.net and Mssql 2008
So I know I can add all the different databases to the project.
and then drag database out on the form and wahlah it produces what i have asked for....
But this would require way to much space and would always be connected to everything?
which i am sure would not be the right way....

But I need to be able to choose between databases and once i select one..
It will connect and load to the datagrids that I have on the forms..


I thought i could use like tree view or a combobox to make the selection .
and then all the datagrids would be connected to the database chosen .


Does any one have any possible solutions to this type scenario

Thanks in Advance...
Jeff

p.s I would provide code But not really for sure how to start.
I am weak on the subject

推荐答案

我使用了一个ComboBox(或者类似的),你可以使用元组填充元素strings - 名称和连接字符串。按名称,连接,查询,断开连接选择数据库。我有几个小应用程序。
I'd use a ComboBox (or similar), you can populate the Items with Tuples of strings -- a name and a connection string. Select a database by name, connect, query, disconnect. I have a few small apps like that.


这篇关于我想在数据库和加载到相同的数据网格之间进行选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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