Posted 4 June 2020, 8:37 pm EST
I’m running Active Reports 11 in Visual Studio 2013
In oracle we have some fields that are in a type called “TIMESTAMP(6) WITH LOCAL TIME ZONE” which displays the time to the user according to their session timezone. I’m trying to get the datasets of page reports to not use the default session timezones which can be done with a command like this:
ALTER SESSION SET TIME_ZONE = ‘US/Eastern’;
I’ve dealt with this problem before in section reports. I was able to get it working within section reports by setting the session timezone before executing the query and then assigning it to the reader like this:
conn = new OracleConnection(loConnectionString);
conn.Open();
OracleCommand cmd;
cmd = new OracleCommand("ALTER SESSION SET TIME_ZONE = '" + parameterlist.GetConfigValue("AGENCY_TIME_ZONE") + "'", conn);
reader = cmd.ExecuteReader();
ReportQuery = WhereStrings;
cmd = new OracleCommand(ReportQuery, conn);
reader = cmd.ExecuteReader();
if (!reader.HasRows)
{
MessageBox.Show("No data found for given parameters.");
this.DataSource = null;
return;
}
this.DataSource = reader;
But I’m not sure how or if it can be done with page reports. What I’m trying to find is a way to get the connection of the dataset to execute the command to set its timezone before whatever query it would normally execute next.
Maybe something similar where I can open the connection in code, execute the command, then hand it off to the page report? Or maybe there’s an event that gets triggered by the dataset that I can access in code to tell it to execute the command before its query?