如何在VB.NET中将故障转移伙伴添加到连接字符串

我有一个连接到数据库的Windows应用程序来读取一些数据.由于数据库是为弹性设置的,因此我的应用程序需要连接到两个数据库中的一个.有人可以指定使用sql server身份验证在连接字符串中指定故障转移伙伴的语法.

任何帮助是极大的赞赏.

检查 connectionstrings.com

Database mirroring
If you connect with ADO.NET or the sql Native Client to a database that is being mirrored,your application can take advantage of the drivers ability to automatically redirect connections when a database mirroring failover occurs. You must specify the initial principal server and database in the connection string and the failover partner server.

Data Source=myServerAddress;Failover Partner=myMirrorServerAddress;Initial
Catalog=myDataBase;Integrated Security=True;

There is ofcourse many other ways to write the connection string using database mirroring,this is just one example pointing out the failover functionality. You can combine this with the other connection strings options available.

相关文章

Format[$] ( expr [ , fmt ] ) format 返回变体型 format$ 强...
VB6或者ASP 格式化时间为 MM/dd/yyyy 格式,竟然没有好的办...
在项目中添加如下代码:新建窗口来显示异常信息。 Namespace...
转了这一篇文章,原来一直想用C#做k3的插件开发,vb没有C#用...
Sub 分列() ‘以空格为分隔符,连续空格只算1个。对所选...
  窗体代码 1 Private Sub Text1_OLEDragDrop(Data As Dat...