dimanche 28 août 2016

C# How to CLONE a DataSet inside if/else statement

i would like to know (if its posible) how to CLONE a DataSet inside an if/else statement, i mean, i want to trigger a query search using a button, then pour that data into the cloned Dataset (that has the exact structure i want, table relations included) to correctly show search data in form. Here is the code:

    private void btn_Click(object sender, EventArgs e)
{

    OdbcConnection conn = new OdbcConnection(); // A connection string...

    if (whatever)
    {
      whatever
    }
    else
    {
        OdbcDataAdapter SearchData = new OdbcDataAdapter(); //Query string...

        //now i need to clone a existing DataSet

        DataSet cloneSet = dataSet.Clone();

        //Then fill it with dat from query

        SearchData.Fill(cloneSet);
    }
} // end of button click event

Is there a way to accomplish this? Thanks in Advance.

Aucun commentaire:

Enregistrer un commentaire