What does 'GET OR SET ACCESSOR EXPECTED' mean?

后端 未结 2 523
遥遥无期
遥遥无期 2020-12-20 12:09
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using System.Data; 
         


        
相关标签:
2条回答
  • 2020-12-20 12:37

    You need parentheses after the function name here:

    void BindEmpData()
    {
        ...
    } 
    

    Also, you'll want to make sure you initialize the DataSet correctly:

    void BindEmpData()
    {
        SqlDataAdapter da = new SqlDataAdapter("select e.ENO,e.ENAME,e.JOB,e.SAL,d.DNAME form EMPLOYEE e,DEPARTMENT d where e.DNO=d.DNO",cn);
        DataSet ds = new DataSet();
        da.Fill(ds,"EMPLOYEE"); 
        Repeater1.DataSource = ds.Table["EMPLOYEE"];
        Repeater1.DataBind();
    } 
    

    And at this point you can remove the ds and da class members, since they are no longer being used (they've been replaced by function variables).

    0 讨论(0)
  • 2020-12-20 12:41

    Parentheses is required to differentiate a method from a property that requires the get/set syntax

    0 讨论(0)
提交回复
热议问题