如何以编程方式显示“数据源配置向导"? [英] How to show the DataSource Configuration Wizard programmatically?

查看:67
本文介绍了如何以编程方式显示“数据源配置向导"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

是否有可能以编程方式显示数据源配置"向导?

Is there any possible chances to show the Data Source Configuration wizard programmatically?


EG:如下所示

DataSourceConfigurationWizard dataSourceWizard= new DataSourceConfigurationWizard();
dataSourceWizard.ShowDialog();

致谢,

Thanks and Regards,

Amal Raj U

Amal Raj U

推荐答案

Amal Raj U,

Hi Amal Raj U,

谢谢您在这里发布.

对于您的问题,我使用datagridview为例.没有直接的方法可以使用像您这样的代码来显示数据源配置"向导

For your question, I use a datagridview for example. There is no direct way to use some code like yours to show the Data Source Configuration wizard.

但是,如果要使用代码,请添加数据源.您可以尝试以下代码.我以Excel为例.将数据从excel导入到datagridview.

But if you want to use code add data source. You could try the following code. I use a excel for example. Import data from excel to datagridview.

  private void button1_Click(object sender, EventArgs e)
        {
            string name = "Sheet1";
            string constr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" +
                            @"C:\Users\v-wezan\Desktop\Excel.xlsx" +
                            ";Extended Properties='Excel 12.0 XML;HDR=YES;';";

            OleDbConnection con = new OleDbConnection(constr);
            OleDbCommand oconn = new OleDbCommand("Select * From [" + name + "


",con); con.Open(); OleDbDataAdapter sda =新的OleDbDataAdapter(oconn); DataTable数据=新的DataTable(); sda.Fill(数据); dataGridView1.DataSource =数据; }
", con); con.Open(); OleDbDataAdapter sda = new OleDbDataAdapter(oconn); DataTable data = new DataTable(); sda.Fill(data); dataGridView1.DataSource = data; }

我希望这会有所帮助.

最好的问候,

温迪


这篇关于如何以编程方式显示“数据源配置向导"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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