TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
anuradha shiv
NA
21
0
populate datagridvie from xml
Jan 6 2010 4:27 AM
Hello All
Need help with LINQ
I have this sticky issue with using select statements from within my code . I dont know how to use one.
The code for the method and the xml structure are as attached.
This is part of the code
public
void
PopulateGrid(
DataSet
dataSets,
String
tableName,
String
testStepId)
{
this
.dataSet = dataSets;
//'this' here is a usercontrol - an Editable Data Grid View to be precise.
IEnumerable
<
Int32
> dfp2 =
from
paramss
in
dataSet.Tables[
"Parameters"
].AsEnumerable()
where
(paramss.Field<
Int32
>(
"TestStep_Id"
) ==
Int32
.Parse(testStepId))
select
paramss.Field<
Int32
?>(
"Parameters_Id"
);
var
p2 =
from
parameter
in
dataSet.Tables[
"Parameter"
].AsEnumerable()
where
parameter.Field<
Int32
>(
"Parameters_Id"
) == (
Int32
)dfp2.First()
select
parameter;
// bindingSource.DataSource = parameter.AsDataView();
bindingSource.DataSource = p2.AsDataView();
.
.
.
.
}
And this is my xml file
<?xml version="1.0" encoding="utf-8" ?>
-
<TestDescription xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" DeviceName="
Three phase meter-1
" DeviceType="
DeltaPlus1
" DescriptionId="
79AB3142-38CD-423d-A0CB-4D49D3E75F13
" Status="
NotStarted
" Version="
1.0
" TimeStamp="
2002-10-10T02:00:00+05:30
" xmlns="urn:DeviceTestDescription">
-
<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 end</ValidationCriteria>
<ValidationError />
</TestCase>
</TestGroup>
</TestSuite>
</TestDescription>
As you can see there are two teststep commands {SetCT and ReadCT } and each has a parameter to it .
My app has two data grid views - one for test steps and the other for parameters pertaining to those test steps. So whenever i click on one of the test steps , i populate the second data grid view with paramters pertaining to the clicked test step.{The above code populates the data grid view for paramters NOT test steps}
How do i frame my select statement so as to be able to get the parameter pertaining to the test step that i have clicked? Is there a better way to do it than what is mentioned above?
Thanks
Avink
Reply
Answers (
1
)
ExpressionTreeVisualizer.
Save DataGridView to XML