title: Interface cannot declare types
body: <p>My problems : I'm trying to follow this tutorial about a wcf service linked with a windows form and using a database: <a href="http://www.c-sharpcorner.com/uploadfile/rohatash/insert-and-display-data-in-datagridview-in-windows-forms-app/" rel="nofollow">http://www.c-sharpcorner.com/uploadfile/rohatash/insert-and-display-data-in-datagridview-in-windows-forms-app/</a></p>
  
  <p>When I run the code I get 2 errors about :
  'IService1' : interfaces cannot declare types.<br>
  'UserDetails' : interfaces cannot declare types.</p>
  
  <p>I've looked for answers on stackoverflow and google but the only questions that was close to mine was unanswered. Also some comments tell it works for them so is it a code problem or maybe a configuration one.
  I put the code of my 2 files IService.cs and Service.cs here :
  the IService.cs</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Runtime.Serialization;
  using System.ServiceModel;
  using System.ServiceModel.Web;
  using System.Text;
  using System.Data.SqlClient;
  using System.Data;
  
  namespace WCFServiceForInsert
  {
      // REMARQUE : vous pouvez utiliser la commande Renommer du menu Refactoriser pour changer le nom d'interface "IService" à la fois dans le code et le fichier de configuration.
      [ServiceContract]
      public interface IService
      {
          // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
          [ServiceContract]
          public interface IService1
          {
              [OperationContract]
              string InsertUserDetails(UserDetails userInfo);
  
              [OperationContract]
              DataSet SelectUserDetails();
          }
  
          // Use a data contract as illustrated in the sample below to add composite types to service operations.
          [DataContract]
           public class UserDetails
          {
              int id;
              string title;
              string salary;
              string benefits;
              string keywords;
              string jobType;
              string location;
              string startDate;
              string description;
              string recruitmentAgency;
              string agencyContact;
              string agencyPhone;
              string agencyEmail;
              string jobRef;
              string datePosted;
              string dateExpire;
  
              [DataMember]
              public int JobID
              {
                  get { return id; }
                  set { id = value; }
              }
  
              [DataMember]
              public string Title
              {
                  get { return title; }
                  set { title = value; }
              }
              [DataMember]
              public string Salary
              {
                  get { return salary; }
                  set { salary = value; }
              }
              [DataMember]
              public string Benefits
              {
                  get { return benefits; }
                  set { benefits = value; }
              }
              [DataMember]
              public string Keywords
              {
                  get { return keywords; }
                  set { keywords = value; }
              }
              [DataMember]
              public string JobType
              {
                  get { return jobType; }
                  set { jobType = value; }
              }
              [DataMember]
              public string Location
              {
                  get { return location; }
                  set { location = value; }
              }
              [DataMember]
              public string StartDate
              {
                  get { return startDate; }
                  set { startDate = value; }
              }
              [DataMember]
              public string Description
              {
                  get { return description; }
                  set { description = value; }
              }
              [DataMember]
              public string RecruitmentAgency
              {
                  get { return recruitmentAgency; }
                  set { recruitmentAgency = value; }
              }
              [DataMember]
              public string AgencyContact
              {
                  get { return agencyContact; }
                  set { agencyContact = value; }
              }
              [DataMember]
              public string AgencyPhone
              {
                  get { return agencyPhone; }
                  set { agencyPhone = value; }
              }
              [DataMember]
              public string AgencyEmail
              {
                  get { return agencyEmail; }
                  set { agencyEmail = value; }
              }
              [DataMember]
              public string JobRef
              {
                  get { return jobRef; }
                  set { jobRef = value; }
              }
              [DataMember]
              public string DatePosted
              {
                  get { return datePosted; }
                  set { datePosted = value; }
              }
              [DataMember]
              public string DateExpire
              {
                  get { return dateExpire; }
                  set { dateExpire = value; }
              }
          }
      }
  
  }
  </code></pre>
  
  <p>the Service.cs file :</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Runtime.Serialization;
  using System.ServiceModel;
  using System.ServiceModel.Web;
  using System.Text;
  using System.Data.SqlClient;
  using System.Data;
  
  namespace WCFServiceForInsert
  {
      // REMARQUE : vous pouvez utiliser la commande Renommer du menu Refactoriser pour changer le nom de classe "Service" à la fois dans le code, le fichier svc et le fichier de configuration.
      public class Service : IService
      {
          public DataSet SelectUserDetails()
          {
              SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=registration;User ID=sa;Password=wintellect");
              con.Open();
              SqlCommand cmd = new SqlCommand("Select * from Table", con);
              SqlDataAdapter sda = new SqlDataAdapter(cmd);
              DataSet ds = new DataSet();
              sda.Fill(ds);
              cmd.ExecuteNonQuery();
              con.Close();
              return ds;
          }
  
          public string InsertUserDetails(IService.UserDetails userInfo)
          {
              string Message;
              Message = "";
              SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=registration;User ID=sa;Password=wintellect");
              con.Open();
              SqlCommand cmd = new SqlCommand("insert into RegistrationTable(Title,Salary,Benefits,Keywords,JobType,Location,StartDate,Description,RecruitmentAgency,AgencyContact,AgencyPhone,AgencyEmail,JobRef,DatePosted,DateExpire) values(@Title,@Salary,@Benefits,@Keywords,@JobType,@Location,@StartDate,@Description,@RecruitmentAgency,@AgencyContact,@AgencyPhone,@AgencyEmail,@JobRef,@DatePosted,@DateExpire)", con);
              cmd.Parameters.AddWithValue("@Title", userInfo.Title);
              cmd.Parameters.AddWithValue("@Salary", userInfo.Salary);
              cmd.Parameters.AddWithValue("@Benefits", userInfo.Benefits);
              cmd.Parameters.AddWithValue("@Keywords", userInfo.Keywords);
              cmd.Parameters.AddWithValue("@JobType", userInfo.JobType);
              cmd.Parameters.AddWithValue("@Location", userInfo.Location);
              cmd.Parameters.AddWithValue("@StartDate", userInfo.StartDate);
              cmd.Parameters.AddWithValue("@Description", userInfo.Description);
              cmd.Parameters.AddWithValue("@RecruitmentAgency", userInfo.RecruitmentAgency);
              cmd.Parameters.AddWithValue("@AgencyContact", userInfo.AgencyContact);
              cmd.Parameters.AddWithValue("@AgencyPhone", userInfo.AgencyPhone);
              cmd.Parameters.AddWithValue("@AgencyEmail", userInfo.AgencyEmail);
              cmd.Parameters.AddWithValue("@JobRef", userInfo.JobRef);
              cmd.Parameters.AddWithValue("@DatePosted", userInfo.DatePosted);
              cmd.Parameters.AddWithValue("@DateExpire", userInfo.DateExpire);
              int result = cmd.ExecuteNonQuery();
              if (result == 1)
              {
                  Message = userInfo.Title + " Details inserted successfully";
              }
              else
              {
                  Message = userInfo.Title + " Details not inserted successfully";
              }
              con.Close();
              return Message;
          }
      }
  }
  </code></pre>