的WinForms连接属性配置对话框,字符串 [英] winforms connection properties dialog for configuration string

查看:211
本文介绍了的WinForms连接属性配置对话框,字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法来显示连接属性的连接字符串浏览(数据库)中运行时对话框?

Is there a way to display the connection properties dialog for connection string browsing(for database) in run time?

正如我希望用户能够使用GUI来连接到各种数据库。 同样的一个作为我们获得在Visual Studio连接属性对话框。

As I want the user to be able to connect to various database using the GUI. The same one as we get in visual studio connection properties dialog.

在此先感谢

推荐答案

查找的这个的文章,解释正是你要寻找的。什么她说的是以下内容:

Look for this article explaining exactly what are you looking for. What she say is the following:

  1. 您将需要添加一对夫妇引用到您的项目:

  1. You will need to add a couple references to your project:

  • 在OLE DB服务组件1.0类型库
  • Microsoft ActiveX数据对象2.x库

使用下面的code:

using MSDASC;
using ADODB;

private string BuildConnectionString()
{
     string strConnString = "";
     object _con = null;
     MSDASC.DataLinks _link = new MSDASC.DataLinks();
     _con = _link.PromptNew();
     if (_con == null) return string.Empty;
     strConnString = ((ADODB.Connection)_con).ConnectionString;
     return strConnString;
}

这篇关于的WinForms连接属性配置对话框,字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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