如何在应用程序启动时创建sql连接对话框 [英] How to make sql connection dialogue box on application start

查看:83
本文介绍了如何在应用程序启动时创建sql连接对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,



i希望在我的应用程序中创建一个SQL Connection对话框,让用户能够连接到不同的数据库,了解他们在应用程序启动时的需求。





您将在这方面快速回复。





问候,



Aamir

Dear All,

i want to make a SQL Connection dialog in my application for users to giving them ability to connect to different Databases regarding their need on application start.


You quick response in this regard will be highly appreciated.


Regards,

Aamir

推荐答案

需要更多详情。它是一个什么样的应用程序? c#,vb.net。 asp.net,wpf等?



只要有一个带有下拉列表的表单弹出窗口,其中包含各种连接字符串,我猜你就是这样。



好​​的。假设您有一组数据库,您已拥有所有信息。然后,您可以使用该数据创建XML文件。像这样...



Need more details. What kind of an app is it? c#, vb.net. asp.net, wpf etc?

Just having a form popup with a dropdown list full of various connection strings is what you are looking for I guess.

Okay. Assuming that you have a set of databases for which you have all the information already. Then you can make an XML file with that data. Like this...

<?xml version="1.0"?>
<DataBase xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Node>
        <Server value="gdms-dolphin" />
        <DB value="BioStar" />
        <User value="sa" />
        <Location value="Los Angeles" />
        <SMTPServer value="Exchange" />
        <EmailID value="johnsmith@gmail.com" />
        <Password value="password" />
    </Node>
    <Node>
        <Server value="gdms-orca" />
        <DB value="BioMoon" />
        <User value="sa" />
        <Location value="Newyork" />
        <SMTPServer value="Exchange" />
        <EmailID value="johndoe@gmail.com" />
        <Password value="password" />
    </Node>
</DataBase>







然后只需阅读XML并填写表格即可。要做到这一点,只需谷歌如何从XML文件填充控件。应该很简单。



另外我猜你的服务器字段应该是一个下拉列表,并选择其中的服务器应该相应地填充其余的字段。这可以在下拉列表的选择更改事件中完成;在winform中再次非常容易。



祝你好运。



[请鼓励通过投票解决方案或适合您的答案参与]




Then just read the XML and populate the form. To do it, just google how to populate controls from XML file. Should be simple.

Also I am guessing your server field should be a dropdown and selecting a server in it should accordingly populate the rest of the fields. This can be done on the selection change event of the dropdown list; again very easy in winform.

Good luck.

[Please encourage participation by up-voting solutions or answers that work for you]


这篇关于如何在应用程序启动时创建sql连接对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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