0

I'm trying to insert row to mySql db and I'm getting this error.

   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
 `groups_users`.`groupID`, 
 `groups_u' at line 1

The Code is

        groups_users ug = new groups_users();
        ug.groupID = 1;
        ug.userID = 1;
        ug.isDeleted = false;
        ug.created = DateTime.Now;
        ctx.groups_users.Add(ug);

        ctx.SaveChanges();

Thanks

2
  • Can you show the larger context of the code (the containing method) Commented Jan 4, 2013 at 21:39
  • 1
    hi Alex Zheludov i am also getting same error here could you please show me example here how you fixed that? Commented Jun 2, 2014 at 8:38

1 Answer 1

3

Fixed it. Had issue in edmx file. all fields were set to be entity keys.

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.