您好:
spread4.0+vs2005(c#、winform)
我想实现:动态的将数据写入spread中 string sqlStr = "Select * From insnodata where jbno=" + "'" + jbno + "' and prjId=" + prjId + " order by saveorder";
DataTable dt = DataBase.dataTable(sqlStr);
sv.RowCount = dt.Rows.Count;
for (int i = 0; i < dt.Rows.Count; i++)
{
for (int intCol = 0; intCol < sv.ColumnCount; intCol++)
{
Fname = sv.Columns[intCol].Tag.ToString();
if (Fname.Contains("null")) continue;
sv.Cells[i, intCol].Text = dt.Rows[i][Fname].ToString();
}
pb.Value = (100 * i / dt.Rows.Count);
}
pb.Value = 0;
sv.FrozenColumnCount = 1;
sv.Columns[17].Visible = false;//隐藏仪表坐标列
sv.Columns[16].Visible = false;//隐藏仪表ID列
我是这么循环写入的,但是感觉很慢,数据库中才十几条的记录,就慢,怎么改善才能快呢,谢谢
|
|