title: System.InvalidOperationException: Can't perform Create, Update, or Delete operations on 'Table(SerialNumbers)' because it has no primary key
body: <p>Currently, I am attempting to use LINQ to connect to a third-party Database to add values to a table that holds serial numbers. However, when I attempt to run my program, the error that is the question title will pop up.</p>
  
  <p>Currently, the program fails on this command:</p>
  
  <pre><code>string STRout = foo.AccountInfo(email, serialNum, "TEST2");
  </code></pre>
  
  <p>Going into the accountInfo method, the line that calls the serialNumber method is the following (its current placement is for testing purposes):</p>
  
  <pre><code>this.newSerialNumber(serialNum);
  </code></pre>
  
  <p>And finally, the newSerialNumber method reads as follows:</p>
  
  <pre><code>[WebMethod]
      public bool newSerialNumber(string serialNum)
      {
          SerialNumbers new_SN = new SerialNumbers();
          //serialNumber is the primary key in the SerialNumbers table
          new_SN.SerialNumber = serialNum;
          new_SN.Count = 1;
          linqQueries.SerialNumbers.InsertOnSubmit(new_SN);
  
          linqQueries.SubmitChanges();
          return true;
      }
  </code></pre>
  
  <p>This code is derived from already-working code, which reads as follows:</p>
  
  <pre><code>[WebMethod]    
  public bool CustomerInfo(string DealershipName, string DealershipEmail, string DealershipAddress, string Name, string DealershipNumber, string DealershipPhone, string serialNumber, string registrationNum)
      {
          //Add the new customer to the table
          CustomerInformation newCustomer = new CustomerInformation();
          newCustomer.DealershipName = DealershipName;
          newCustomer.DealershipEmail = DealershipEmail;
          newCustomer.DealershipAddress = DealershipAddress;
          newCustomer.Name = Name;
          newCustomer.DealershipNumber = DealershipNumber;
          newCustomer.DealershipPhone = DealershipPhone;
          linqQueries.CustomerInformations.InsertOnSubmit(newCustomer);
  
          linqQueries.SubmitChanges();
          //string activateCode = getActivation(registrationNum);
  
          CustomerAccount newAccount = new CustomerAccount();
          newAccount.SerialNumber = serialNumber;
          newAccount.DealershipEmail = DealershipEmail;
          newAccount.RegistrationNumber = registrationNum;
          newAccount.CustomerInformation = newCustomer;
          linqQueries.CustomerAccounts.InsertOnSubmit(newAccount);
  
          linqQueries.SubmitChanges();
  
          return true;
      }
  </code></pre>
  
  <p>In addition to the serialNumber value being the primary key in the SerialNumbers table, it is also listed as a unique value. </p>
  
  <p>Am I missing something, or is there some sort of workaround to this exception that I'm unaware of in this case?</p>