简体   繁体   English

如何使用 c# 更新 sql 中的一个特定单元格

[英]How to update one specific cell in sql using c#

In the table there is no primary key, So I have contact list for as follows在表中没有主键,所以我有如下的联系人列表

id ID Contact接触
10302 10302 *******08 *******08
10302 10302 *******69 *******69
10302 10302 *******52 *******52

I want to update one specific contact with using where clause and did that it is updating all number I have no idea how to do it.我想使用 where 子句更新一个特定的联系人,并且这样做是在更新所有号码,我不知道该怎么做。

can any one help?有人可以帮忙吗?

You'll need two filters in your WHERE clause for the update, apart from the ID, the old Contact value so you only update that row in the table (provided that the table doesn't have two rows with the same ID and Contact)您需要在 WHERE 子句中使用两个过滤器进行更新,除了 ID 和旧的联系人值,因此您只更新表中的该行(前提是该表没有两行具有相同的 ID 和联系人)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM