Thursday, March 31, 2011

Date Range in AOT Query from SSRS


Query:
How can I add date ranges in an AOT query linked to SSRS.

Answer:
Kindly use the following sample code to create a data method and then use it as a source for report data set.

    [DataMethod(), AxSessionPermission(SecurityAction.Assert)]
    public static DataTable GetData(DateTime fromDate, DateTime toDate)
    {
        DataTable table = new DataTable();
        IDictionary myRanges = new Dictionary();
        myRanges.Add("AOTTable.Date",
fromDate.ToString("dd/MM/yyyy") + ".." + toDate.ToString("dd/MM/yyyy"));
        table = AxQuery.ExecuteQuery("select * from AOTQuery", myRanges);
        return table;
    }

No comments:

Post a Comment