使用C#将数据从SSIS包加载到Gridview

时间:2013-10-11 12:58:15

标签: c# ssis

我使用C#将数据从sql加载到Gridview,并且正常工作,以下是代码:

private void button1_Click(object sender, EventArgs e)
{
    SqlConnection con = new SqlConnection(@"Data Source=NICK-PC;Initial Catalog=ssis_project;Integrated Security=True;");

    try
    {
        SqlDataAdapter sda = new SqlDataAdapter("Select * from users ", con);
        DataTable dbdataset = new DataTable();
        sda.Fill(dbdataset);
        BindingSource bSource = new BindingSource();
        bSource.DataSource = dbdataset;
        dataGridView1.DataSource = bSource;
        sda.Update(dbdataset);
    }
    catch (Exception ex) 
    {
        MessageBox.Show(ex.Message);
    }
}

如何使用C#将数据从SSIS包加载到Gridview?

以下是SSIS包中OLEDB的代码:

SELECT * FROM users WHERE username = ? AND password = ?

0 个答案:

没有答案