简体   繁体   English

参数附近的语法不正确(带有SQL的C#)

[英]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. 将数据插入数据库时​​,出现异常“ @ p1附近的语法不正确”。

问题

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) (顺便说一句,对代码中的某些外语表示抱歉。这是一个学校项目,我正在上的学校不是英语)

You got your insert syntax wrong, it should be: 您的插入语法错误,应该是:

INSERT INTO Leti VALUES ( @p1,@p2,@p3,.....)
                        ^                  ^
                        |-you missed these-|
Your insert statement should be like this :
      INSERT INTO 

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM