DbCommand Insert error标识符'INTO'附近的查询语法

时间:2013-12-18 06:06:53

标签: c# entity-framework sql-server-ce

我真的无法理解为什么我会“标识符'INTO'附近的查询语法”?

Ctx = new aiautodbEntities(connectionstring);
Ctx.Connection.Open();
    var comm = Ctx.Connection.CreateCommand();
                        comm.CommandText = "INSERT INTO ListUsers (u_name,u_personalnumber,u_login,u_pass,u_position,u_ugadn,u_ugadndata,u_serverId) values(@u_name,@u_personalnumber,@u_login,@u_pass,@u_position,@u_ugadn,@u_ugadndata,@u_serverId)";
                        comm.Parameters.Add(new EntityParameter(){ParameterName="u_name",Value= newUser.u_name});
...
                        comm.ExecuteNonQuery();

即使我写

INSERT INTO ListUsers (u_name) values ('fdfdbf');

我有同样的错误。

我使用DbConnection, SqlCE, EntityFramework

enter image description here

1 个答案:

答案 0 :(得分:0)

尝试:

INSERT INTO [ListUsers] ([u_name]) VALUES ('fdfdbf');