#region 在datagridview中显示dt
       
private void display(DataGridView dgv,DataTable dt)
       {
           dgv.Rows.Clear();
           
if (dt != null)
           {
               
object[] item = new object[dt.Columns.Count];
               
for (int i = 0; i < dt.Rows.Count; i++)
               {
                   
for (int j = 0; j < dt.Columns.Count; j++)
                   {
                       item[j] 
= dt.Rows[i][j];
                   }
                   dgv.Rows.Add(item);
               }
           }
           dgv.Update();

       }
       
#endregion
posted on 2009-07-14 16:46  钱途无梁  阅读(406)  评论(0编辑  收藏  举报