|
[Quote=Quote the post of the original poster继续跟随教主:]
m_pSCSet-> Requery();
while(!m_pSCSet-> IsEOF())
{
if((m_pSCSet-> m_grade <=69)&&(m_pSCSet-> m_grade> =60))
{
m_pSCSet-> m_grade += 5;
m_pSCSet-> Update();
m_pSCSet-> MoveNext();
}
}
The problem is to find the tuples in the table whose score is between 60 and 69, and add 5 points to the score, but I use the above code to indicate that the update attempt failed
[/Quote]
Use SQL directly
update tb
set fenshu = fenshu + 5
where fenshu between 60 and 69
It can also be like this.
declare @sql as varchar(100)
set @sql ='update tb set fenshu = fenshu + 5 where fenshu between 60 and 69'
exec(@sql)
You can put this SQL statement into your vc variable and execute it dynamically.
However, VC should not use exec, but use his own things. |
|