所以,我想将此查询插入数据库文件中:
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
列:
这是参数化(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
答案 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;
或重命名该列。