0

When uploading the data in mysql database using entityframework below error occured:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(SELECT outstanding_master.CustomerID, outstanding_master.`Na' at line 1

   foreach (DataRow dr in ds.Tables[0].Rows)
            {
                //object value = null;

                outstanding_master master = new outstanding_master();
                {
                    master.CustomerID = dr[0].ToString();
                    //   EntityKey orderKey =
                    // new EntityKey("UploadsEntities.outstanding_master", "CustomerID", master.CustomerID);
                    master.Name = dr[1].ToString();
                    master.PhoneNumber = Convert.ToInt64(dr[2].ToString());
                    master.Address = dr[3].ToString();
                    master.ServiceProviderID = Convert.ToInt32(dr[4].ToString());
                    master.TotalDue = dr[5].ToString();
                    master.LastPaidAmount = dr[6].ToString();
                    master.LastPaidDate = Convert.ToDateTime(dr[7].ToString());
                    master.OutStandingDescription = dr[8].ToString();
                    master.longitudeandlatitude = dr[9].ToString();
                }
                db.outstanding_master.Add(master);
                  db.SaveChanges();
    }
1

1 Answer 1

0

Here In my database for outstanding_master table not having the primary key when i added hat it's working fine.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.