我无法弄清我的更新功能。我能够从我的数据库中检索和删除,但我不知道如何更新。这对我来说都是新的,所以我很难过。CRUD更新不正常
js文件
//update user
$("#btnUpdateUser").click(function() {
$.ajax({
type: 'PUT',
url: uri,
data: JSON.stringify(vendor),
processdata: true,
public int updateUser(vendors vendors, int id)
{
SqlCommand cmd = new SqlCommand("UPDATE vendors set [user][email protected], [email protected], [email protected], [email protected], [email protected] where [email protected]", con);
cmd.Parameters.AddWithValue("@id", id);
cmd.Parameters.AddWithValue("@user", vendors.user);
cmd.Parameters.AddWithValue("@email", vendors.email);
我得到一个“未发现记录”之前,但我不再得到那个。 任何指导/提示将不胜感激。
你确定你想更新id字段? –
你使用的是实体框架还是类似的东西? –
另外,请告诉我们您正在使用的数据库后端。 –