1

I really can't understand Why I get it "The syntax of the query near identifier '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();

Even if i write

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

I have the same error.

I use DbConnection, SqlCE, EntityFramework

enter image description here

Community
  • 1
  • 1
Risa
  • 147
  • 1
  • 2
  • 15
  • Take a look at [this question](http://stackoverflow.com/questions/225121/profiler-for-sql-ce). A kind of a profiler or query logging application should help you find the query being sent to the db. – shahkalpesh Dec 18 '13 at 08:18

1 Answers1

0

Try:

INSERT INTO [ListUsers] ([u_name]) VALUES ('fdfdbf');
Haney
  • 32,775
  • 8
  • 59
  • 68
  • do not work =( [dbo].[ListUsers] not work too, @"INSERT INTO [ListUsers] ([u_name]) VALUES ('fdfdbf')" - not work too. – Risa Dec 18 '13 at 06:17
  • have added table schema – Risa Dec 18 '13 at 06:26
  • "The syntax of the query near identifier 'ListUsers'" Not sure that "try remove the INTO" - lead to the correct query – Risa Dec 18 '13 at 06:37