配置字符串的 winforms 连接属性对话框
Is there a way to display the connection properties dialog for connection string browsing(for database) in run time?
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.
Thanks in Advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
查找这篇文章解释正是您在寻找什么。她的说法如下:
您需要为您的项目添加一些引用:
使用以下代码:
Look for this article explaining exactly what are you looking for. What she say is the following:
You will need to add a couple references to your project:
Use the following code:
我一直在寻找这个,看来微软已经发布了 Visual Studio 连接对话框的源代码,以便它可以在 VS 之外使用:
我刚刚尝试过,它工作正常:)
更新 7/2019
自 Microsoft 代码该网站是黑暗的,并且似乎没有关于
数据连接对话框
的 Microsoft 官方帖子,这里有一个包含 Microsoft 代码的 Github 用户存储库的链接。https://github.com/kjbartel/ConnectionDialog
原始但现已失效的链接 http://code.msdn.microsoft.com/Connection
I was looking for exactly that, and it appears that Microsoft has published the source for the Visual Studio connection dialog, so that it can be used outside VS :
I just tried it, it works fine :)
Update 7/2019
Since the Microsoft Code site is dark, and there doesn't seem to be an official Microsoft posting for
Data Connection Dialog
, here is a link to a Github user repository with the Microsoft code.https://github.com/kjbartel/ConnectionDialog
Original but now dead link http://code.msdn.microsoft.com/Connection
我不知道是否存在“预定义”表单,但是,您当然可以创建自己的表单,并使用 DbConnectionStringBuilder 类 (SqlConnectionStringBuilder, OracleConnectionStringBuilder,OleDbConnectionStringBuilder),根据用户在自定义创建的表单上输入的参数创建连接字符串。
I don't know if there exists a 'predefined' form for it, but, you could offcourse create your own form, and use one the DbConnectionStringBuilder classes (SqlConnectionStringBuilder, OracleConnectionStringBuilder, OleDbConnectionStringBuilder) to create the connectionstring from the parameters the user entered on your custom created form.
您还可以使用通用数据链接文件
http:// msdn.microsoft.com/en-us/library/e38h511e%28VS.71%29.aspx
使用 XP,但我从未在 Vista 或 7 中尝试过
You can also use Universal Data Link Files
http://msdn.microsoft.com/en-us/library/e38h511e%28VS.71%29.aspx
Work with XP but I never tried it in Vista or Seven