المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : updating multiple rows of a single column with different values at runtime from C#



C# Programming
11-12-2009, 07:11 AM
Hello

I am working on examination project. I hava a column Position in Database. I am storing position in this column on the basis of obtained marks.suppose that i have entered 50 students record and assign each student a position on the basis of obtained marks. now i enter 51 number student and the obtained marks of this new student are higher than all students,definitely i will assign 1(ist position) to this student and all other students Positions will be changed. A student who is on ist position before entering 51 student record will changed from ist to 2nd position and rest of students positions also changed.

Now when i use update command from C# it only updates one row and left other rows to old values. i am using update in a loop.

And only a single row which is updated is of those student who has less marks than new 51 number student and rest of the rows are not updated.

Plz reply immediate

Thanks

Regards Usman Ahmad