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

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

问题描述

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

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

由于我想让用户能够连接到使用GUI的各种数据库。
与我们在视觉工作室连接属性对话框中一样。

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.

感谢提前

http://www.freeimagehosting.net/uploads/c59e853019.jpg http://www.freeimagehosting.net/uploads/c59e853019 .jpg

推荐答案

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

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库

使用MSDASC使用以下代码:

Use the following 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天全站免登陆