SQL Server CE查询解析时出错

时间:2012-07-03 19:15:58

标签: c# parsing sql-server-ce

所以,我想将此查询插入数据库文件中:

UPDATE contas 
SET nome = @nome, endereço = @endereco, serv_envio = @envio, 
    serv_recep = @recep, pass = @pass, user = @user, 
    tipo = @tipo, Seguro = @seguro 
WHERE id = @id

但是,每次我尝试使用它时,都会收到此错误:

  

解析查询时出错。 [令牌行号= 1,令牌行偏移= 101,令牌错误=用户]

但是,经过一个小时试图找出可能是错的,我仍然找不到错误。

这里也是数据库:

表:Contas

列:

  • ID(主要整数自动增加)
  • Nome(文字)
  • Endereço(文字)
  • Serv_Envio(文字)
  • Serv_Recep(text)
  • 用户(文字)
  • 通过(文本)
  • Tipo(外国整数)
  • Defeito(布尔)
  • Seguro(布尔)

这是参数化(C#):

command.Parameters.AddWithValue("@nome", tb_nome.Text);
command.Parameters.AddWithValue("@endereco", tb_mail.Text);
command.Parameters.AddWithValue("@envio", tb_envio.Text);
command.Parameters.AddWithValue("@recep", tb_recep.Text);
command.Parameters.AddWithValue("@pass", tb_pass.Text);
command.Parameters.AddWithValue("@user", tb_user.Text);
command.Parameters.AddWithValue("@tipo", cb_tipo.SelectedIndex + 1);
command.Parameters.AddWithValue("@id", idconta);
command.Parameters.AddWithValue("@seguro", seguro);

那么,有什么帮助吗?

提前致谢。

JoãoBorrego

1 个答案:

答案 0 :(得分:2)

user是保留字。尝试:

UPDATE contas SET nome=@nome, endereço=@endereco, serv_envio=@envio, 
  serv_recep=@recep, pass=@pass, [user]=@user, tipo=@tipo, Seguro=@seguro 
WHERE id=@id;

或重命名该列。