cmd._CommandText = "U_PDATE {表A} Set 标记 = 2 Where (id = (S_ELECT TOP 1 id FROM {表A} WHERE id = " & did & " AND 标记 = 1 AND dname = \'" & dname & "\' order by Data))"
cmd.ExecuteNonQuery()
说明:_为发贴需要,实际无_,_C发贴省略
(我是希望不用另外增加前台数据表,直接在后台实现)
结果变成所有符合的数据都修改为标记=2了,
此主题相关图片如下:snipaste_2023-04-20_17-41-06.jpg
我只是想修改最早的一条,不是所有符合的多条数据全部修改。百度,GPT都尝试过了,没找到方法,是不是不能实现?
能想到的另外方法,就是只能增加表,加载符合的数据,排序,再将ROW(0)修改。
-_-!!
用
cmd._CommandText = "U_PDATE {表A} Set 标记 = 2 Where (data = (S_ELECT TOP 1 data FROM {表A} WHERE id = " & did & " AND 标记 = 1 AND dname = \'" & dname & "\' order by Data))"
解决。
不知道data重复会不会有影响,保险一点用[_Identify]主键了。
cmd._CommandText = "U_PDATE {表A} Set 标记 = 2 Where ([_Identify]= (S_ELECT TOP 1 [_Identify] FROM {表A} WHERE id = " & did & " AND 标记 = 1 AND dname = \'" & dname & "\' order by Data))"