我是WCF的新手。我做了一个应用程序,它是如下WCF中的错误无法将方法组“getAllEmpName”转换为非委托类型“对象”。你打算采用这种方法吗?
我有服务如下
void IService1.getAllEmpName()
{
SqlConnection con = new SqlConnection("Data Source=SYSTEM19\\SQLEXPRESS;Initial Catalog=Dora;Integrated Security=True");
SqlCommand cmd = new SqlCommand("Select *from Users", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
}
我的界面如下
[ServiceContract]
public interface IService1
{
[OperationContract]
void getAllEmpName();
[OperationContract]
void editEmployee();
}
在我的网页我做如下
private void get_categories()
{
ServiceReference1.Service1Client ws = new ServiceReference1.Service1Client();
GridView1.DataSource = ws.getAllEmpName();
GridView1.DataBind();
}
我得到的错误为Cannot convert method group 'getAllEmpName' to non-delegate type 'object'. Did you intend to invoke the method?
任何一个帮助都可以