Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Private
  • Views: 69
  • Last Modified:

Linq - get results

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
petel2k
Asked:
petel2k
1 Solution
 
petel2kAuthor Commented:
all set
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now