Crystal displays blank report...pls help!!!

M

Mounilk

Hi,
i am hoping that someone from this group has had the problem and
is able to help. Also, if you think there is another more appropriate
group that i can post this to; please let me know.

From within Crystal Reports, my report displays the data; but when
i run my C# application, it displays a blank report (shows the text
objects) but does not display any data. I ran the query in the query
analyzer and it returns records. The report's datasource is a stored
procedure and it has 1 parameter.

Here's my code:

private void btnShowReport_Click(object sender, System.EventArgs e)
{
CrystalDecisions.Windows.Forms.CrystalReportViewer crvReport;
ReportDocument rdEmployer;

Database crDatabase;
Tables crTables;
TableLogOnInfo crTableLogOnInfo;
ConnectionInfo crConnectionInfo;
rdEmployer = new ReportDocument();

rdEmployer.Load(strReportLocation);

crConnectionInfo = new ConnectionInfo();
crConnectionInfo.ServerName = "MyServer";
crConnectionInfo.DatabaseName = "MyDatabase";
crConnectionInfo.IntegratedSecurity = true;
crDatabase = rdEmployer.Database;
crTables = crDatabase.Tables;

foreach (Table crTable in crTables)
{
crTableLogOnInfo = crTable.LogOnInfo;
crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
crTable.ApplyLogOnInfo(crTableLogOnInfo);

string sLocation = crConnectionInfo.DatabaseName +
".dbo." +
crTable.Location.Substring(crTable.Location.LastIndexOf(".") + 1);

crTable.Location = sLocation;
crTable.LogOnInfo.ConnectionInfo.ServerName =
crConnectionInfo.ServerName;
}


CrvReport = new
CrystalDecisions.Windows.Forms.CrystalReportViewer();
crvReport.ReportSource = rdEmployer;

int iParameterCount = rdEmployer.ParameterFields.Count;

ParameterField[] arrParameterField = new
ParameterField[iParameterCount];
ParameterDiscreteValue[] arrParameterDiscreteValue =
new ParameterDiscreteValue[iParameterCount];

for (int i = 0; i < iParameterCount; i++)
{
arrParameterField =
crvReport.ParameterFieldInfo;
}

IDictionaryEnumerator dicParameterValues;
dicParameterValues =
lstParameterValues.GetEnumerator();
int iParameters;
iParameters = 0;

while (dicParameterValues.MoveNext())
{
object ParameterValue = dicParameterValues.Value;
arrParameterDiscreteValue[iParameters] = new
ParameterDiscreteValue();
arrParameterDiscreteValue[iParameters].Value =
ParameterValue;

arrParameterField[iParameters].CurrentValues.Add(arrParameterDiscreteValue[iParameters]);
iParameters++;
}

this.WindowState =
System.Windows.Forms.FormWindowState.Maximized;
this.Controls.Add(crvReport);
crvReport.DisplayGroupTree= false;
crvReport.Dock = System.Windows.Forms.DockStyle.Fill;
crvReport.AutoScroll = true;
crvReport.ShowCloseButton = true;
crvReport.Visible = true;
crvReport.ShowRefreshButton = false;

}//btnShowReport_Click
 
M

Mounilk

Here's an update,
If i press the Refresh button on the
CrystalReportViewer, it pops up the Enter Parameter Values window
again, and then if i enter the parameter value, it displays the report
WITH the data. Any idea as to what's happening?

TIA,
Mounil.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top