【Vegas原创】显示DataGrid中几行的数据

System.DateTime currentTime=new System.DateTime(); 
            currentTime
=System.DateTime.Now; 
            
int year= currentTime.Year; 
            
int month=currentTime.Month;
            
int day = currentTime.Day;
            
int column = day + 3+5;
            
//int column= day +3-26;
            string strSql = "SELECT F1,F2,F3,F" + column + " FROM [Beol-DT$]";
            OleDbConnection conn 
= new OleDbConnection(strConn); 
        
//    OleDbCommand com =new OleDbCommand("SELECT F1,F2,F3,F7 FROM [Beol-DT$]",conn); 
            OleDbCommand com =new OleDbCommand(strSql,conn); 
            OleDbDataAdapter da
=new OleDbDataAdapter(com); 
            DataSet ds
=new DataSet(); 
            da.Fill(ds);
            
for (int i = 10; i < 18; i++)                    //b
            {
                ds.Tables[
0].Rows[i].Delete();               //b

            }
        
//    ds.Tables[0].Rows[17][0] = "Rework";

            for (int i = 25; i < 32 ; i++)                    //b
            {
                ds.Tables[
0].Rows[i].Delete();               //b

            }

            ds.Tables[
0].AcceptChanges();                     //b
            DataGrid1.DataSource=ds.Tables[0].DefaultView;    
            DataGrid1.DataBind(); 

 

posted @ 2006-11-02 11:11  李济宏(Amadeus)  阅读(117)  评论(0编辑  收藏  举报