asp.net中日期的查询表达式中的语法错误(缺少运算符)

时间:2015-01-09 15:44:38

标签: asp.net string excel datetime datetime-format

excel中的日期是日期时间格式,所选日期也是日期时间格式但是可以解决问题

        OleDbDataAdapter da1 = new OleDbDataAdapter("SELECT [ProjectId],[ProjectName],[ManagerID],[ManagerName],[AllocationStartDate],[AllocationEndDate],[horizontalshortname] FROM [" + getExcelSheetName + @"] where [horizontalshortname]="+ "'" + TextBox_Horizontal.Text + "'" 
        + " AND [Isonsite]=" + "'" + DropDownList_Location.SelectedItem.Text + "'"
        + " AND [AllocationStartDate]>="+Calendar1.SelectedDate 
        + " AND [AllocationEndDate]<="+Calendar2.SelectedDate 
        , conn);





        DataSet ds1 = new DataSet();
        da1.Fill(ds1);

        //if (ds.Tables[0] !=  null )
        if (ds1.Tables[0].Rows.Count > 0)
        {
            GridView_Utilization_Search.Visible = true;
            GridView_Utilization_Search.DataSource = ds1.Tables[0];
            GridView_Utilization_Search.DataBind();
        }
        else
        {
            GridView_Utilization_Search.Visible = false;

        }

0 个答案:

没有答案