I'm using this query on a wpf application:
"INSERT INTO [Table]([fname],[lname],[cdate]) VALUES(" + @fname + "," + @lname + "," + @DateTime.Now + ")"
But it doesn't seem to work, it says: Incorrect Syntax near '12'. The problem has got to be somewhere in my DateTime since when I turn my code to this:
"INSERT INTO [Table]([fname],[lname]) VALUES(" + @fname + "," + @lname + ")";
The query executes perfectly fine.
The cdate has a datetime data type in SQL, if anyone was wondering.