Reputation: 2779
I'm a newbie to asp .net and c# world. I'm trying to insert a very new record into a simple task manager database table, tasks (name, description, priority, start_date, end_date)
Here is my Task.cs and add.aspx code: http://pastie.org/691005
When I submit the form, it just redirect me back to the Default.aspx page. Is there anyway to debug the inside the Insert method of Task.cs? How can I output the sql query from within the Task.cs file? I'm using Microsoft SQL express.
Thank you
Upvotes: 0
Views: 1172
Reputation: 12815
I think your INSERT
statement's syntax is wrong.
You have:
INSERT INTO Tablename Field1=Value1, Field2=Value2...
The correct syntax is:
INSERT INTO Tablename (Field1, Field2... ) VALUES ( Value1, Value2... )
The syntax you're using works for an UPDATE
statement, as in
UPDATE Tablename SET field1=value1, field2=value2...
WHERE some-key-fieldname=some-key-value
Upvotes: 6