Hi
I have a problem with updating my datagridview using data table . I am unable to get the select statement right .. Could some one help please
This is my xml fragment in question
<TestSuite> <TestGroup ID="1001" Description="Group1" ErrorCondition="Skip">
<TestCase ID="1001" Description="CT">
<TestStep Command="SetCT" ID="" Description="Set CT">
<Parameters>
<Parameter Name="setCTRatio" Value="8232" Direction="Write" />
Parameters>
TestStep>
<TestStep Command="ReadCT" ID="" Description="Get CT">
<Parameters>
<Parameter Name="getCTRatio" Direction="Read" />
Parameters>
TestStep>
<ValidationCriteria>if setCTRatio == getCTRatio testResult.valid = true else testResult.valid = false endValidationCriteria>
<ValidationError />
TestCase>
TestGroup>
TestSuite>
As u see there can be many test steps to each test case and each of the test steps has its own set of data .
I want to get the parameters pertaining to a test step that is clicked .
The data structure would be like this
Table "Parameters"
TestStep_Id Parameters_Id
0 0
1 1
Table Parameter
Parameters_Id Name Direction
0 A B
0 C D
1 E F
So if i clicked on TestStep "0" , then the query must pick up Parameters_Id from the table "Parameters" and retrieve only those rows of "Parameter" where Paramters_Id = "0";
I hope i am clear
Loading
anuradha shivPosted Jan 12, 2010, 2:16 AM
My data grid view is previously bound to some data table .
If i create a temporary data table (here drtemp) which is a subset of the original table and later make it the DataSource for the data table , it does not save .. how to handle this ?
anuradha shivPosted Jan 12, 2010, 12:28 AM
I think there is more to it . It has got to be a join or a nested query coz we got to first get the "Parameters_Id" from the first table if TestStep_Id is equal to some thing that i pass as the formal parameter to the function.
Then as a second step , i got to match the "Parameters_Id" got from the previous step with the "Parameter_Id" of the table "Parameter" and get the selected rows from it.
Check out the attachment
Nilanka DharmadasaPosted Jan 12, 2010, 12:00 AM
I hope I got your problem. Check following code.
Let's say the name of parametrs datatable is 'dtParas'.
DataTable dttemp = dtParas.Clone();
DataRow[] rows = dtParas.Select("Paramters_Id = 0");
foreach(DataRow r in rows)
{
dttemp.ImportRow(r);
}
dttemp.AcceptChanges();
dataGridView1.DataSource = dttemp;
If you find any prob, let me know.
If this is helpful, please tick 'Do you like this answer' checkbox.