friderik
friderik

Reputation: 137

Incorrect syntax near parameter (C# with SQL)

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)

Upvotes: 0

Views: 1254

Answers (2)

Prabha Rajan
Prabha Rajan

Reputation: 68

Your insert statement should be like this :
      INSERT INTO 

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

Upvotes: 1

Sadique
Sadique

Reputation: 22841

You got your insert syntax wrong, it should be:

INSERT INTO Leti VALUES ( @p1,@p2,@p3,.....)
                        ^                  ^
                        |-you missed these-|

Upvotes: 3

Related Questions