用于选择 SQL Server 和获取登录详细信息的通用对话框?
我的应用程序需要询问用户要连接到什么 SQL Server 以及用于连接的凭据,我想知道是否有人已经构建了一个对话框 - 功能类似于框架附带的 OpenFileDialog(在显示它,然后您可以询问它选择了哪个文件),但看起来像 SQL Management Studio 的登录框。
理想情况下,我会 .Show 对话框,然后一旦完成,我可以获得一个 .ConnectionString 属性,该属性返回与他们选择的所有详细信息关联的字符串。
如果曾经不存在,我想开始创建它的过程,因为我想这对人们来说能够放置在表单上并从用户那里获取数据库连接会很有帮助。
My application needs to ask the user what SQL Server to connect to and what credentials to use for the connection, and I was wondering if there's a dialog box out there that somebody has already built - functioning like the OpenFileDialog that comes with the framework (in that you .Show it, then you can ask it which file was picked), but looking like the login box from SQL Management Studio.
Ideally, I'd .Show the dialog, and then once it finished, I could get a .ConnectionString property that returned the string associated with all the details they picked.
If once doesn't exist, I'd like to start the process to create it, because I imagine it would be helpful for people to just be able to drop on a form and have getting a database connection from the user taken care of.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
是的,Visual Studio 中使用的“连接属性”对话框也可以作为独立组件提供:
http://code.msdn.microsoft.com/Connection
Yes, the 'Connection Properties' dialog box that is used within Visual Studio is also available as a stand-alone component:
http://code.msdn.microsoft.com/Connection
我不知道,但是创建一个应该相当简单,并且您可以使用 SQL Server SMO 对象,它应该具有您需要的所有方法。
http://msdn.microsoft.com/en-us/library/ms162169.aspx
Not that I'm aware of, however it should be fairly simple to whip one up and you can use the SQL Server SMO objects which should have all the methods you need.
http://msdn.microsoft.com/en-us/library/ms162169.aspx
我没有,因为生产中的应用程序通常会登录到同一个 sql 服务器,因此它们只输入其 userID 和 pwd。
他们是否应该能够访问任何 sql 服务器,或者是否可以使用业务术语来隐藏实际的服务器名称?
假设您的应用程序需要知道它们是否想要登录到开发、测试或生产服务器。您可以有一个包含这 3 个值的下拉菜单,并在某处查找服务器名称。然后您只需要标准的 userID 和 pwd 条目。
I don't have one, because typically the application in production logs in to the same sql server, so they only enter their userID and pwd.
Should they be able to access any sql server, or are there business terms you could use to hide the actual server name?
Say your application needs to know if they want to log on to the dev, test, or prod server. You could have a drop-down with those 3 values and a lookup somewhere to the server names. Then you just need the standard userID and pwd entries.