Executing an SQL statement in C#?

前端 未结 5 749
醉话见心
醉话见心 2021-01-07 09:17

Hey guys i want to execute my SQL statement but im having synatx trouble, can someone help me understand what i doin wrong please?

Thanks, Ash.

publi         


        
5条回答
  •  误落风尘
    2021-01-07 10:02

    You need to add single quotes around the first argument in the SQL Statement.

    string sSQL = "INSERT INTO WordDef (Word, Good, Bad, Remove) VALUES ('" + WordArray[WordCount] + "', " + Good + ", " + Bad + ", " + Remove + ")";
    

    Character and Date fields require values to be surrounded with 'single quotes'

提交回复
热议问题