同一台电脑安装了两个SQLExpress实例:SQLExpress1、SQLExpress2,如何在程序中读取到这两个实例
解决方案 »
- DataGridView中编程方式修改数据不能更新到数据库?
- 如何获取FTP服务器上文件的最后修改时间
- 为什么安装后会这样
- 一个关于托盘的问题,急、急、急......
- **asdfasdfsafsafhaisodfasoifhsa@@ 使用正则表达式怎么匹配?
- 简单问题,al是一个ArrayList类型的动态数组,其中存放了一些Double类型的数据,比如说有10个吧,我想更改其中的一些数据,al[3]="abc"
- 初级问题(全局变量的问题)
- 桌面程序中文本框怎么限制只能输入数字?
- 再次提问:狂送分100,不够再送!!!
- 数据库的列名?
- 8位图(256)像素?
- 使用Thread.Sleep(5000),程序假死,请问该如何解决呢??
读注册表 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL
下面的链键就是对应安装的实例名
Server=.\SQLExpress;AttachDbFilename=c:\mydbfile.mdf;Database=dbname; Trusted_Connection=Yes;
http://blogs.msdn.com/b/sqlexpress/archive/2006/07/29/faq-detecting-sql-server-2005-using-wmi.aspx
你看, ado.net 2.0 出来这么久了 ,
System.Data.Common.DbDataSourceEnumerator emumerator = System.Data.SqlClient.SqlClientFactory.Instance.CreateDataSourceEnumerator();
DataTable table = emumerator.GetDataSources();
if (table != null && table.Rows.Count > 0) {
this.dataGridView1.DataSource = table;
}
DataTable table = emumerator.GetDataSources();
if (table != null && table.Rows.Count > 0) {
this.dataGridView1.DataSource = table;
}
DataTable table = emumerator.GetDataSources();
if (table != null && table.Rows.Count > 0) {
this.dataGridView1.DataSource = table;
}这个是正解,, 不过, 那速度,跟蜗牛儿似的,, 如果不需要扫描网络的话,还是用查注册表的吧