jrmcdona
asked on
my report has the same data everytime I access it
In my web app, my report has the same data everytime I access it. I DO NOT have the Save Data with Report checked. The only data that comes up is the data that gets displayed in design time.
I am updating my parameters but when i trace the stored procedure calls the parameters are not updated.
The data doesn't update whether I use crystal viewer or generate the report in pdf.
I am using crystal 9 advanced, Windows 2003, SQL Server. I have been at this for sometime now and cannot get it figured out!
Any help would be great.
Thanks, Jordan
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls ;
using System.IO;
using System.Collections.Special ized;
using System.Configuration;
using CrystalDecisions.Web;
using CrystalDecisions.CrystalRe ports.Engi ne;
using CrystalDecisions.Shared;
using JHS.App.Reports.CrystalFil es;
namespace JHS.App.Reports
{
/// <summary>
/// Summary description for InmateReport.
/// </summary>
public class InmateReport : System.Web.UI.Page
{
protected ReportDocument crReportDocument = new CustomerGeneralReport();
protected string _ID1;
protected string _ID2;
protected string _ID3;
protected string url;
ConnectionInfo crConnectionInfo;
TableLogOnInfo crtableLogoninfo;
protected CrystalDecisions.Web.Cryst alReportVi ewer CrystalReportViewer1;
Tables crTables;
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
url = ConfigurationSettings.AppS ettings["U RL"];
Response.Expires=-1;
try
{
HttpContext ctx = HttpContext.Current;
HttpCookie inCookie = ctx.Request.Cookies["2JHS3 "];
if(inCookie != null)
{
_ID1= inCookie.Values["ID1"].ToS tring();
_ID2= inCookie.Values["ID2"].ToS tring();
_ID3= inCookie.Values["ID3"].ToS tring();
}
crConnectionInfo = new ConnectionInfo();
crReportDocument.SetParame terValue(" @param1", _ID1);
crReportDocument.SetParame terValue(" @param2", _ID2);
crReportDocument.SetParame terValue(" @param3", _ID3);
crConnectionInfo.ServerNam e = ConfigurationSettings.AppS ettings["S ERVER_NAME "];
crConnectionInfo.DatabaseN ame = ConfigurationSettings.AppS ettings["D BNAME"];
crConnectionInfo.UserID = ConfigurationSettings.AppS ettings["U SERID"];
crConnectionInfo.Password = ConfigurationSettings.AppS ettings["P ASSWORD"];
crTables = crReportDocument.Database. Tables;
//Loop through each table in the report and apply the
//LogonInfo information
foreach (CrystalDecisions.CrystalR eports.Eng ine.Table crTable in crTables)
{
crtableLogoninfo = crTable.LogOnInfo;
crtableLogoninfo.Connectio nInfo = crConnectionInfo;
crTable.ApplyLogOnInfo(crt ableLogoni nfo);
crTable.Location = crConnectionInfo.DatabaseN ame + ".dbo." + crTable.Location.Substring (crTable.L ocation.La stIndexOf( ".") + 1);
}
CrystalReportViewer1.Repor tSource = crReportDocument;
CrystalReportViewer1.Visib le = true;
/*
System.IO.Stream st;
st = crReportDocument.ExportToS tream(Expo rtFormatTy pe.Portabl eDocFormat );
Response.ClearContent();
Response.ClearHeaders();
Response.Expires=-1;
Response.ContentType = "application/PDF";
byte[] b = new byte[st.Length];
st.Read(b,0,(int) st.Length);
Response.BinaryWrite(b);
crReportDocument.Close();
Response.Flush();
Response.Close();
*/
}
catch (FormatException ex)
{
Response.Write(ex.ToString ());
}
I am updating my parameters but when i trace the stored procedure calls the parameters are not updated.
The data doesn't update whether I use crystal viewer or generate the report in pdf.
I am using crystal 9 advanced, Windows 2003, SQL Server. I have been at this for sometime now and cannot get it figured out!
Any help would be great.
Thanks, Jordan
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls
using System.IO;
using System.Collections.Special
using System.Configuration;
using CrystalDecisions.Web;
using CrystalDecisions.CrystalRe
using CrystalDecisions.Shared;
using JHS.App.Reports.CrystalFil
namespace JHS.App.Reports
{
/// <summary>
/// Summary description for InmateReport.
/// </summary>
public class InmateReport : System.Web.UI.Page
{
protected ReportDocument crReportDocument = new CustomerGeneralReport();
protected string _ID1;
protected string _ID2;
protected string _ID3;
protected string url;
ConnectionInfo crConnectionInfo;
TableLogOnInfo crtableLogoninfo;
protected CrystalDecisions.Web.Cryst
Tables crTables;
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
url = ConfigurationSettings.AppS
Response.Expires=-1;
try
{
HttpContext ctx = HttpContext.Current;
HttpCookie inCookie = ctx.Request.Cookies["2JHS3
if(inCookie != null)
{
_ID1= inCookie.Values["ID1"].ToS
_ID2= inCookie.Values["ID2"].ToS
_ID3= inCookie.Values["ID3"].ToS
}
crConnectionInfo = new ConnectionInfo();
crReportDocument.SetParame
crReportDocument.SetParame
crReportDocument.SetParame
crConnectionInfo.ServerNam
crConnectionInfo.DatabaseN
crConnectionInfo.UserID = ConfigurationSettings.AppS
crConnectionInfo.Password = ConfigurationSettings.AppS
crTables = crReportDocument.Database.
//Loop through each table in the report and apply the
//LogonInfo information
foreach (CrystalDecisions.CrystalR
{
crtableLogoninfo = crTable.LogOnInfo;
crtableLogoninfo.Connectio
crTable.ApplyLogOnInfo(crt
crTable.Location = crConnectionInfo.DatabaseN
}
CrystalReportViewer1.Repor
CrystalReportViewer1.Visib
/*
System.IO.Stream st;
st = crReportDocument.ExportToS
Response.ClearContent();
Response.ClearHeaders();
Response.Expires=-1;
Response.ContentType = "application/PDF";
byte[] b = new byte[st.Length];
st.Read(b,0,(int) st.Length);
Response.BinaryWrite(b);
crReportDocument.Close();
Response.Flush();
Response.Close();
*/
}
catch (FormatException ex)
{
Response.Write(ex.ToString
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I was opening my reports in a new browswer, which I do on my production server currently and everything is great.
I set up a new server with Windows 2003 and things are acting up now.
I changed my reports to not spawn a new window and I also just now added:
crReportDocument.Refresh()
This has made my reports work just great. However, when I return to spawning the reports in a new window the cookies are not being found. I don't understand at all what is causing that. It works fine. I am wondering if it has something to do with 2003 and IIS6?
THanks,
Jordan