【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();
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();
喜欢请赞赏一下啦^_^
![](https://images.cnblogs.com/cnblogs_com/amadeuslee/1997630/o_21070809243911.jpg)