سؤال

I want to achieve this:

UPDATE MyTable SET Field1=Field1 + 1 WHERE Field2 = 1 AND Field1 = 5000

Just to explain why is that im verifying that nobody else touched the record, Field1 is a sequence number.

How to achieve this, im thinking something like. MyDb.MySchema.Table.UpdateByField1AndField2(Field1: 5000, Field2: 1, Field1: 5001). Obviously this does not work.

هل كانت مفيدة؟

المحلول

what about ...

MyDb.MySchema.Table.UpdateAll(Field1: 5001, Condition: MyDb.MySchema.Table.Field1==5000 && MyDb.MySchema.Table.Field2==1)

?

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top