SolvedPrivate

Linq - get results

Posted on 2013-12-02
1
48 Views
Last Modified: 2016-02-10
The4 following LinQ does not work at all. There are rows which do match, though no results given.

 IEnumerable<string> query = from s in AllTeamData  
                           where s.dbName == "CWILLI"
                           orderby s.dbName
                                        select s.dbName;

Class -->
public class DBTeams 
        {
            public DBTeams(string team, string name, string month, string aht, string efficiency, 
                string creditcount,string credit,string monitor, string scoreadhere, string overall,
                string calldur,string calldurout,string wrapin,string rating, string wrapout, string holdtime, string numofmons, string extn)
            {
                this.dbTeam = team;
                this.dbName = name;
                this.dbMonth = month;
                if (aht != "" && aht != null)
                {
                    this.dbAHT = decimal.Parse(aht);
                }
                if (efficiency != "" && efficiency != null)
                {
                    this.dbEffeciency = decimal.Parse(efficiency);
                }
                if (credit != "" && credit != null)
                {
                    this.dbCredit = decimal.Parse(credit);
                }
                if (creditcount != "" && creditcount != null)
                {
                    this.dbCreditCount = int.Parse(creditcount);
                }
                if (monitor != "" && monitor != null)
                {
                    this.dbMonitor = decimal.Parse(monitor);
                }
                if (scoreadhere !="" && scoreadhere != null)
                {
                this.dbScoreAdhere = decimal.Parse(scoreadhere);
                }
                if (overall != "" && overall != null)
                {
                    this.dbOverAll = decimal.Parse(overall);
                }
                if (calldur != "" && calldur != null)
                {
                    this.dbCallDur = decimal.Parse(calldur);
                }
                if (calldurout != "" && calldurout != null)
                {
                    this.dbCallDurOut = decimal.Parse(calldurout);
                }
                if (wrapin != "" && wrapin != null)
                {
                    this.dbWrapIn = decimal.Parse(wrapin);
                }
                if (rating != "" && rating != null)
                {
                    this.dbRating = decimal.Parse(rating);
                }
                if (wrapout != "" && wrapout != null)
                {
                    this.dbWrapOut = decimal.Parse(wrapout);
                }
                if (holdtime != "" && holdtime != null)
                {
                    this.dbHoldTime = decimal.Parse(holdtime);
                }
                if (numofmons != "" && numofmons != null)
                {
                    this.dbNumOfMons = int.Parse(numofmons);
                }
                this.dbExtn = extn;

            }
            public string dbTeam { get; set; }
            public string dbName { get; set; }
            public string dbMonth { get; set; }
            public decimal dbAHT { get; set; }
            
            public decimal dbEffeciency { get; set; }
            public decimal dbCredit { get; set; }
            public int dbCreditCount { get; set; }
            public decimal dbMonitor { get; set; }
            public decimal dbScoreAdhere { get; set; }
            public decimal dbOverAll { get; set; }
            public decimal dbCallDur { get; set; }
            public decimal dbCallDurOut { get; set; }
            public decimal dbWrapIn { get; set; }
            public decimal dbRating { get; set; }
            public decimal dbWrapOut { get; set; }
            public decimal dbHoldTime { get; set; }
            public int dbNumOfMons { get; set; }
            public string dbExtn { get; set; }

        }
        
    }

Open in new window


Load data from service-->
public void webService_GetSqlResultTableCompleted(object sender, WCFSvc1.GetSqlResultTableCompletedEventArgs e)
        {
            string xmlResult = e.Result;
            if (xmlResult == "")
            {
                MessageBox.Show("Error occured while executing SQL");
                return;
            }

            XmlSerializer serializer = new XmlSerializer(typeof(List<List<string>>));
            StringReader reader = new StringReader(xmlResult);
            List<List<string>> result = (List<List<string>>)serializer.Deserialize(reader);

            dataGrid1.Columns.Clear();
    
            List<DBTeams> AllTeamData = new List<DBTeams>();

            for (int i = 0; i < result[0].Count; i++)
            {
                    DataGridTextColumn textCol = new DataGridTextColumn { Header = result[0][i], Binding = new Binding("[" + i + "]") };
                    this.dataGrid1.Columns.Add(textCol);
             }
            result.RemoveAt(0); //remove captions

           for (int i = 0; i < result.Count; i++) // loop through data from service 
            {
                AllTeamData.Add(new DBTeams(result[i][1], result[i][2], result[i][3], result[i][4], result[i][5], result[i][6],
                    result[i][4], result[i][4],
                    result[i][7], result[i][8], result[i][9], result[i][10], result[i][11], result[i][12], result[i][13], result[i][14],
                    result[i][16], result[i][16]));
            }
          

           IEnumerable<string> query = from s in AllTeamData   
                           where s.dbName == "CWILLI"
                           orderby s.dbName
                                        select s.dbName;
           
        }

Open in new window

0
Comment
Question by:petel2k
1 Comment
 

Accepted Solution

by:
petel2k earned 0 total points
ID: 39689960
all set
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question