Setting up session timezones

Posted by: mschmitz on 26 September 2017, 10:09 am EST

  • Posted 26 September 2017, 10:09 am EST

    Hello I'm trying to set up a session timezone before running the query for a report. As an example what I would need is for the application to run this command:


    Followed by the query the report uses. This needs to all be in the same session without having to establish a new connection so that this timezone applies to the query. This is needed so that fields of type timestamp are interpreted according to the timezone we would be reporting for so that the return data is shown in that rather than my own.
  • Replied 26 September 2017, 11:11 pm EST

    Hey I managed to figure out how to set the session timezone

    First added these 2 private members to the report

    private System.Data.OleDb.OleDbConnection conn;
    private System.Data.OleDb.OleDbDataReader reader;

    Then added this in the reportstart event where ReportQuery_SQL is the query of the report

    conn = new System.Data.OleDb.OleDbConnection(loConnectionString);
    System.Data.OleDb.OleDbCommand cmd = new System.Data.OleDb.OleDbCommand("ALTER SESSION SET TIME_ZONE = '" + parameterlist.GetConfigValue("AGENCY_TIME_ZONE") + "'", conn);
    reader = cmd.ExecuteReader();
    cmd = new System.Data.OleDb.OleDbCommand(ReportQuery_SQL, conn);
    reader = cmd.ExecuteReader();
    this.DataSource = reader;
  • Replied 27 September 2017, 5:26 am EST

    Glad to know you were able to figure out how to add session time-zones and for sharing it with us. I'm sure it'll be helpful for other users who would be trying to achieve the same thing. We value your contribution.
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels