Click here to Skip to main content
15,886,873 members
Home / Discussions / C#
   

C#

 
AnswerRe: Recordlist in object blocked by error Pin
Dave Kreskowiak18-Apr-21 11:34
mveDave Kreskowiak18-Apr-21 11:34 
AnswerRe: Recordlist in object blocked by error Pin
James Curran20-Apr-21 3:37
James Curran20-Apr-21 3:37 
QuestionWhy BeginGetContext of HTTPListener within Window's Service didn't react or trigger? Pin
razzqc16-Apr-21 5:19
razzqc16-Apr-21 5:19 
AnswerRe: Why BeginGetContext of HTTPListener within Window's Service didn't react or trigger? Pin
Gerry Schmitz16-Apr-21 8:37
mveGerry Schmitz16-Apr-21 8:37 
GeneralRe: Why BeginGetContext of HTTPListener within Window's Service didn't react or trigger? Pin
razzqc16-Apr-21 10:06
razzqc16-Apr-21 10:06 
QuestionWhy GC.Collect() call twice required when use GC.WaitForPendingFinalizers() Pin
Mou_kol10-Apr-21 22:06
Mou_kol10-Apr-21 22:06 
AnswerRe: Why GC.Collect() call twice required when use GC.WaitForPendingFinalizers() Pin
OriginalGriff10-Apr-21 22:48
mveOriginalGriff10-Apr-21 22:48 
QuestionC# Unable to update data table values Pin
Mou_kol10-Apr-21 1:34
Mou_kol10-Apr-21 1:34 
I am trying to find data in xml file using LINQ but my ANY() or WHERE clause found no data. what is the problem in my approach not clear.

I have a xml file which which has been created by Dataset WriteXml() function. that file i am querying by LINQ and data not found occur.

See my XML structure
C#
<?xml version="1.0" standalone="yes"?>
<TER_ViewAll>
<dgvViewAll_Vertical>
    <Section_x0020_>ML</Section_x0020_>
    <LineItem>BofA Merrill Lynch</LineItem>
    <Revise_x0020_Date>01-16-2018</Revise_x0020_Date>
    <_x0032_010_x0020_FYA>1608.6500</_x0032_010_x0020_FYA>
    <_x0032_011_x0020_FYA>1429.0610</_x0032_011_x0020_FYA>
    <_x0032_012_x0020_FYA>1656.7500</_x0032_012_x0020_FYA>
    <_x0032_013_x0020_FYA>1427.9330</_x0032_013_x0020_FYA>
    <_x0031_Q_x0020_2014A>321.0100</_x0031_Q_x0020_2014A>
    <_x0032_Q_x0020_2014A>525.5670</_x0032_Q_x0020_2014A>
    <_x0033_Q_x0020_2014A>478.0100</_x0033_Q_x0020_2014A>
    <_x0034_Q_x0020_2014A>323.2360</_x0034_Q_x0020_2014A>
    <_x0032_014_x0020_FYA>1647.8230</_x0032_014_x0020_FYA>
    <_x0031_Q_x0020_2015A>342.4010</_x0031_Q_x0020_2015A>
    <_x0032_Q_x0020_2015A>512.7390</_x0032_Q_x0020_2015A>
    <_x0033_Q_x0020_2015A>465.9940</_x0033_Q_x0020_2015A>
    <_x0034_Q_x0020_2015A>318.4440</_x0034_Q_x0020_2015A>
    <_x0032_015_x0020_FYA>1639.5780</_x0032_015_x0020_FYA>
    <_x0031_Q_x0020_2016A>430.9940</_x0031_Q_x0020_2016A>
    <_x0032_Q_x0020_2016A>531.7920</_x0032_Q_x0020_2016A>
    <_x0033_Q_x0020_2016A>410.4750</_x0033_Q_x0020_2016A>
    <_x0034_Q_x0020_2016A>379.9890</_x0034_Q_x0020_2016A>
    <_x0032_016_x0020_FYA>1753.2500</_x0032_016_x0020_FYA>
    <_x0031_Q_x0020_2017A>456.9130</_x0031_Q_x0020_2017A>
    <_x0032_Q_x0020_2017A>696.9010</_x0032_Q_x0020_2017A>
    <_x0033_Q_x0020_2017A>503.3780</_x0033_Q_x0020_2017A>
    <_x0034_Q_x0020_2017A />
    <_x0032_017_x0020_FYA />
    <_x0031_Q_x0020_2018A />
    <_x0032_Q_x0020_2018A />
    <_x0033_Q_x0020_2018A />
    <_x0034_Q_x0020_2018A />
    <_x0032_018_x0020_FYA />
    <_x0031_Q_x0020_2019A />
    <_x0032_Q_x0020_2019A />
    <_x0033_Q_x0020_2019A />
    <_x0034_Q_x0020_2019A />
    <_x0032_019_x0020_FYA />
    <_x0031_Q_x0020_2020A />
    <_x0032_Q_x0020_2020A />
    <_x0033_Q_x0020_2020A />
    <_x0034_Q_x0020_2020A />
    <_x0032_020_x0020_FYA />
    <_x0031_Q_x0020_2021E />
    <_x0032_Q_x0020_2021E />
    <_x0033_Q_x0020_2021E />
    <_x0034_Q_x0020_2021E />
    <_x0032_021_x0020_FYE />
    <_x0031_Q_x0020_2022E />
    <_x0032_Q_x0020_2022E />
    <_x0033_Q_x0020_2022E />
    <_x0034_Q_x0020_2022E />
    <_x0032_022_x0020_FYE />
    <GroupKey>Consensus Model~Net Revenue~TRIN~NBM~~1~ML</GroupKey>
  </dgvViewAll_Vertical>
  </TER_ViewAll>


the above xml is one records and xml file has many records like above one. i load that xml file by data ser and querying by LINQ. this way i am querying.
C#
private void button1_Click(object sender, EventArgs e)
        {
            string QCViewPath_savepath = @"C:\RDSS WorkBench_Stage\Data\TER\TER_QC-ViewwAll.xml";
            DataSet ds = new DataSet();
            ds.ReadXml(QCViewPath_savepath);

            if (ds.Tables[0].AsEnumerable().Any(a => a.Field<string>("Section ") == "ML"
                            && a.Field<string>("GroupKey").Contains("Consensus Model")
                            && a.Field<string>("GroupKey").Contains("Net Revenue")
                            && a.Field<string>("GroupKey").Contains("NBM")
                            && a.Field<string>("GroupKey").Contains("1")
                            && a.Field<string>("GroupKey").Contains("ML")
                            ))
            {
                ds.Tables[0].AsEnumerable().Where(a => a.Field<string>("Section ") == "ML"
                     && a.Field<string>("GroupKey").Split('~')[0].Trim() == "Consensus Model"
                     && a.Field<string>("GroupKey").Split('~')[1].Trim() == "Net Revenue"
                     && a.Field<string>("GroupKey").Split('~')[3].Trim() == "NBM"
                     && a.Field<string>("GroupKey").Split('~')[4].Trim() == "1"
                     && a.Field<string>("GroupKey").Split('~')[5].Trim() == "ML"
                     ).ToList<DataRow>()
                     .ForEach(r =>
                     {
                         r["2010 FYA"] = 1200;
                     });

            }
        }


My object is to update data table periodical value and save that data at last after all update. after querying data table i am getting Enumeration yielded no results

please help with rectified code. Thanks

modified 10-Apr-21 8:01am.

AnswerRe: C# Unable to update data table values Pin
OriginalGriff10-Apr-21 2:13
mveOriginalGriff10-Apr-21 2:13 
GeneralRe: C# Unable to update data table values Pin
Mou_kol10-Apr-21 3:04
Mou_kol10-Apr-21 3:04 
GeneralRe: C# Unable to update data table values Pin
Dave Kreskowiak10-Apr-21 4:23
mveDave Kreskowiak10-Apr-21 4:23 
GeneralRe: C# Unable to update data table values Pin
OriginalGriff10-Apr-21 7:57
mveOriginalGriff10-Apr-21 7:57 
GeneralRe: C# Unable to update data table values Pin
OriginalGriff10-Apr-21 8:00
mveOriginalGriff10-Apr-21 8:00 
GeneralRe: C# Unable to update data table values Pin
Richard MacCutchan10-Apr-21 21:07
mveRichard MacCutchan10-Apr-21 21:07 
GeneralRe: C# Unable to update data table values Pin
jschell17-Apr-21 7:09
jschell17-Apr-21 7:09 
AnswerRe: C# Unable to update data table values Pin
Mou_kol10-Apr-21 3:00
Mou_kol10-Apr-21 3:00 
SuggestionRe: C# Unable to update data table values Pin
Richard Deeming11-Apr-21 21:23
mveRichard Deeming11-Apr-21 21:23 
GeneralRe: C# Unable to update data table values Pin
Mou_kol12-Apr-21 7:06
Mou_kol12-Apr-21 7:06 
QuestionHour and minute slider Pin
Valakik8-Apr-21 9:49
Valakik8-Apr-21 9:49 
AnswerRe: Hour and minute slider Pin
OriginalGriff8-Apr-21 22:20
mveOriginalGriff8-Apr-21 22:20 
AnswerRe: Hour and minute slider Pin
BillWoodruff9-Apr-21 4:19
professionalBillWoodruff9-Apr-21 4:19 
QuestionC# Linq Get Count of Joined Records Pin
Kevin Marois8-Apr-21 9:34
professionalKevin Marois8-Apr-21 9:34 
AnswerRe: C# Linq Get Count of Joined Records Pin
OriginalGriff8-Apr-21 9:40
mveOriginalGriff8-Apr-21 9:40 
GeneralRe: C# Linq Get Count of Joined Records Pin
Kevin Marois8-Apr-21 9:50
professionalKevin Marois8-Apr-21 9:50 
GeneralRe: C# Linq Get Count of Joined Records Pin
OriginalGriff8-Apr-21 10:05
mveOriginalGriff8-Apr-21 10:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.