Click here to Skip to main content
11,576,635 members (57,792 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: WCF
Iservice1.cs :

namespace Employeer
    // NOTE: If you change the interface name "IService1" here, you must also update the reference to "IService1" in Web.config.
    public interface IService1
          Employee GetEmployee();
    public class Employee
        public int Empid { get; set; }
        public string Name { get; set; }
        public string Address { get; set; }
        public string City { get; set; }
        public string State { get; set; }
        public string Employeerid { get; set; }


namespace Employeer
    // NOTE: If you change the class name "Service1" here, you must also update the reference to "Service1" in Web.config and in the associated .svc file.
    public class Service1: IService1
        String strConnection = ConfigurationManager.ConnectionStrings["MyConsString"].ConnectionString;
        SqlConnection conn = new SqlConnection(strConnection);
        public List<Employee> GetEmployee(int Employeerid)
            List<Employee> objEmployees = new List<Employee>();
                SqlCommand cmd = new SqlCommand("select * from Employeetable where Employeerid Like '%'+@Employeerid+'%'", conn);
                cmd.Parameters.AddWithValue("@Employeerid", Employeerid);
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                DataTable dt = new DataTable();

Posted 28-Dec-12 22:36pm
Edited 28-Dec-12 22:48pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 2

The error is pretty clear:
'Employeer.Service1' does not implement interface member 'Employeer.IService1.GetEmployee()'
Your Interface definition includes:
Employee GetEmployee();
but your class declares:
List<Employee> GetEmployee(int Employeerid) {...}
These are not the same overload: the Interface expects a method with no parameters that returns an Employee, you have only declared a method that takes an integer and returns a List of Employees.
Either change your interface definition, or your class, (or both) as is appropriate.
dhritirao1221 at 29-Dec-12 4:55am
'Employeer.Service1.GetEmployee(int)': not all code paths return a value
now im getting this error
OriginalGriff at 29-Dec-12 5:05am
Without seeing the code you have written for it, I can't help...
dhritirao1221 at 29-Dec-12 5:13am
thanks for ur help
OriginalGriff at 29-Dec-12 5:29am
You're welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 251
1 Abhinav S 170
2 DamithSL 105
3 Lucifier Rocks 105
4 Dave Kreskowiak 80
0 OriginalGriff 715
1 Sergey Alexandrovich Kryukov 631
2 Abhinav S 528
3 F-ES Sitecore 420
4 Suvendu Shekhar Giri 365

Advertise | Privacy | Mobile
Web03 | 2.8.150603.1 | Last Updated 29 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100