插入一个新的记录(ASP .NET和C#) [英] Insert a new record (asp .net & c#)

查看:75
本文介绍了插入一个新的记录(ASP .NET和C#)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个新手到ASP .NET和C#的世界。我试图插入一个非常新的记录到一个简单的任务管理器数据库表,任务(名称,描述,优先级,日期,结束日期)

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)

下面是我的Task.cs和add.aspx code:
http://pastie.org/691005

Here is my Task.cs and add.aspx code: http://pastie.org/691005

当我提交表单,它只是重定向我回到Default.aspx页面。反正是有调试Task.cs的插入方法里面呢?我怎么能输出从Task.cs内的SQL查询文件?我使用的是Microsoft SQL前preSS。

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.

感谢您

推荐答案

我觉得你的插入语句的语法是错误的。

I think your INSERT statement's syntax is wrong.

您有:

INSERT INTO Tablename Field1=Value1, Field2=Value2...

正确的语法是:

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

这篇关于插入一个新的记录(ASP .NET和C#)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆