0

I've got a problem that's driving me crazy. I get an exception "Incorrect syntax near "@p1" " when I'm inserting data into my database.

problem

I looked for solutions on the internet but nothing solved this problem so far. Does anyone have a clue what is wrong with my code? Thanks! (By the way, sorry for some foreign language in code. It's a school project and the school that I'm attending is not english)

1
  • See also INSERT INTO, the 2nd example is really what you should be writing as specifying the column names is best practice. Otherwise your statement breaks or you will get unexpected results if your table schema ever changes (ie. column order changes). Commented Mar 12, 2017 at 11:01

2 Answers 2

3

You got your insert syntax wrong, it should be:

INSERT INTO Leti VALUES ( @p1,@p2,@p3,.....)
                        ^                  ^
                        |-you missed these-|
Sign up to request clarification or add additional context in comments.

Comments

1
Your insert statement should be like this :
      INSERT INTO 

INSERT INTO Leti VALUES (@p1,@p2,@p3,@p4);

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.