Problems Binding GridView with LINQ

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • finie
    New Member
    • Sep 2010
    • 1

    Problems Binding GridView with LINQ

    Hi, I'm using Linq to bind a gridview and when I debug I get this exception:
    "Input string was not in a correct format."
    this function loads with the Form
    Code:
        
    private void DGVWCcode_Changed()
            {
                SalaryDClassesDataContext dc = new SalaryDClassesDataContext();
                BindingSource bs = new BindingSource();
                var wcmpnnts = from c in dc.Wage_Components
                               where c.EmployerID == int.Parse(tbEmplyrId.Text)
    
                      select new
                      {
                        ComponentCode = c.cmpnntCode,
                        ComponentDiscrition= c.cmnntDscrpt,
              };
     
                DGVWCcodes.DataMember = null;
                bs.DataSource= wcmpnnts;/****here I get the exception***/
                DGVWCcodes.DataSource = bs;
            }
    is it because my DBis Still empty and can't get null cells?
    if not can you tell me what the problem is?
    Last edited by Frinavale; Sep 21 '10, 03:09 PM. Reason: Added the description of the problem to the thread and fixed the title.
Working...