Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
public SomeMethod{

DataSet ds = new DataSet();

            SqlCommand testCaseCommand = new SqlCommand(pTestCaseTableQueryString, SQLconnection);
            this._testCaseDataAdapter = new SqlDataAdapter(testCaseCommand);
            this._testCaseCommandBuilder = new SqlCommandBuilder(_testCaseDataAdapter);
            //this._testCaseDataAdapter.Fill(testCaseDataTable);
            this._testCaseDataAdapter.Fill(ds, "QualityCheckTestCaseTable");
            this._testCaseDataAdapter.DeleteCommand = this._testCaseCommandBuilder.GetDeleteCommand(true);
            this._testCaseDataAdapter.UpdateCommand = this._testCaseCommandBuilder.GetUpdateCommand(true);
            this._testCaseDataAdapter.InsertCommand = this._testCaseCommandBuilder.GetInsertCommand(true);
            this._testCaseSourceBindingSource = new BindingSource();
            this._testCaseSourceBindingSource.DataSource = ds;
            this._testCaseSourceBindingSource.DataMember = "QualityCheckTestCaseTable";

            SqlCommand designerItemCommand = new SqlCommand(pDesignerItemQuertyString, SQLconnection);
            this._designerItemDataAdapter = new SqlDataAdapter(designerItemCommand);
            this._DesignerItemCommandBuilder = new SqlCommandBuilder(this._designerItemDataAdapter );
            //this._designerItemDataAdapter.Fill(designerItemDataTable);
            this._designerItemDataAdapter.Fill(ds,"AnticipationDesignerItemTable");
            this._designerItemDataAdapter.DeleteCommand = this._DesignerItemCommandBuilder.GetDeleteCommand();
            this._designerItemDataAdapter.UpdateCommand = this._DesignerItemCommandBuilder.GetUpdateCommand();
            this._designerItemDataAdapter.InsertCommand = this._DesignerItemCommandBuilder.GetInsertCommand();

            var relation = new DataRelation("TestCaseRelation", ds.Tables["QualityCheckTestCaseTable"].Columns["TestCaseID"],
                            ds.Tables["AnticipationDesignerItemTable"].Columns["RTestCaseID"]);

            ds.Relations.Add(relation);

            this._designerItemBindingSource = new BindingSource();
            this._designerItemBindingSource.DataSource = this._testCaseSourceBindingSource;
            this._designerItemBindingSource.DataMember = "TestCaseRelation";
}

public SaveTableToSQL()
{
     this._testCaseDataAdapter.Update(QualityCheckTestCaseTabl);

     this._designerItemDataAdapter.Update(AnticipationDesignerItemTable);
}


when i modify AnticipationDesignerItemTable, it can work. But when i modify QualityCheckTestCaseTable, have nothing to change

tthanks
Posted
Updated 11-Mar-14 23:11pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900