C# split用法

 1 string [] sss = txtQueryVal.Text.ToString().Split( new   char []  {'-'} );
 2
 3                      string  year = sss[ 0 ].ToString();
 4                      string  month = sss[ 1 ].ToString();
 5                      string  day = sss[ 2 ].ToString();
 6
 7                      string  selsql4 = " select * from OA_Worklog where Datepart(year,OA_Worklog_Day)=' " + year + " 'and Datepart(month,OA_W orklog_Day)=' " + month + " 'and Datepart(day,OA_Worklog_Day)=' " + day + " ' " ;
 8                     SqlDataAdapter sqlCom4 = new  SqlDataAdapter(selsql4,sqlCon);
 9                     DataSet ds = new  DataSet();
10                     sqlCom4.Fill(ds, " OA_Worklog " );
11                     DGrid_QueryResult.DataSource = ds.Tables[ " OA_Worklog " ].DefaultView;
12                     DGrid_QueryResult.DataKeyField = " OA_Worklog_Id " ;
13                     DGrid_QueryResult.DataBind();

你可能感兴趣的:(split)