for (int i = 0; i < lb.Items.Count; i++)
{
string strSql = "update imgs set tu= " + lb.Items[i].Text + " where ID= " + lb.Items[i].Value;
db.suoLueData(strSql);
}
lb.Items[i].Text 的值是字符型的
lb.Items[i].Value 的值是int型的
这样写怎么不能用?
------解决方案--------------------------------------------------------
for (int i = 0; i < lb.Items.Count; i++)
{
string strSql = "update imgs set tu= ' " + lb.Items[i].Text + " ' where ID= " + lb.Items[i].Value;
db.suoLueData(strSql);
}
--------------
string要用 ' '包起来啊
tu= ' " + lb.Items[i].Text + " '