SqlConnection conn = new SqlConnection(ClassConnAll.conmmsy);
try
{
conn.Open();
for (int i = 0; i < this.dataGridViewItemCls.Rows.Count; i++)
{
SqlCommand comm = new SqlCommand();
string id= this.dataGridViewItemCls.Rows[i].Cells[0].Value.ToString().Trim();
//string SqlStr = "INSERT testbiao(sheet222,名称) VALUES ('" + gdh + "','" + pn + "')";
string SqlStr = "update t_bd_item_clsmmsy set return_rate=" + tbPlDS.Text
+ " where id="+id
+ " and branch_no like'%" + ClassConnAll.branchNo.Trim().ToString() + "%'";
comm.CommandText = SqlStr;
comm.Connection = conn;
comm.ExecuteNonQuery();
}
selectItemCls(ClassConnAll.treeViewItemcls,ClassConnAll.treeViewItemclsName);
}
catch (Exception ex)
{
MessageBox.Show("更新失败,失败原因:" + ex.Message);
}
finally
{
conn.Close();
selectItemCls(ClassConnAll.treeViewItemcls, ClassConnAll.treeViewItemclsName);
}
try
{
conn.Open();
for (int i = 0; i < this.dataGridViewItemCls.Rows.Count; i++)
{
SqlCommand comm = new SqlCommand();
string id= this.dataGridViewItemCls.Rows[i].Cells[0].Value.ToString().Trim();
//string SqlStr = "INSERT testbiao(sheet222,名称) VALUES ('" + gdh + "','" + pn + "')";
string SqlStr = "update t_bd_item_clsmmsy set return_rate=" + tbPlDS.Text
+ " where id="+id
+ " and branch_no like'%" + ClassConnAll.branchNo.Trim().ToString() + "%'";
comm.CommandText = SqlStr;
comm.Connection = conn;
comm.ExecuteNonQuery();
}
selectItemCls(ClassConnAll.treeViewItemcls,ClassConnAll.treeViewItemclsName);
}
catch (Exception ex)
{
MessageBox.Show("更新失败,失败原因:" + ex.Message);
}
finally
{
conn.Close();
selectItemCls(ClassConnAll.treeViewItemcls, ClassConnAll.treeViewItemclsName);
}