Crystal report help please

R

Raghu Raman

Hi,

am using crystal report in my c#.net

The report was initially designed with the RDO Connection and uses the
stroed proc,This sp requires 4 parameters.In my c# web app , i simply
included the report(.rpt) file and made an object for that and am
passing the parameters.Finally it gives the error message as,

LOGON FAILED.

Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details:
CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed.

--------------------My code----------------
rpt_proc_auditlog rpt=new rpt_proc_auditlog();
TableLogOnInfo loginfo=new TableLogOnInfo();
ConnectionInfo coninfo=new ConnectionInfo();
Database crDatabase;
Tables crTables;
//Table crTable;
crDatabase=rpt.Database;
coninfo.ServerName="TCMS";
coninfo.UserID="TCMS_DATA";
coninfo.Password="SOCOOL";
coninfo.DatabaseName ="TCMS_DATA";
crDatabase=rpt.Database;
crTables=crDatabase.Tables;
foreach(CrystalDecisions.CrystalReports.Engine.Table crTable in
crTables)
{
loginfo = crTable.LogOnInfo;
loginfo.ConnectionInfo = coninfo;
crTable.ApplyLogOnInfo(loginfo);
}
//rpt.SetDatabaseLogon("TCMS_DATA","SOCOOL","TCMS","TCMS_DATA");
rpt.SetParameterValue("sDisplayLabel","Header");
rpt.SetParameterValue("STABLENAME","MASTERPHYS");
rpt.SetParameterValue("NPKID",Convert.ToInt16("3664"));
CREP.ReportSource=rpt;
--------------
cOULD YOU PLEASE TELL ME THE MISTAKE I MADE.


With thanks
Raghu
 
E

Elton Wang

Hi Raghu,

Although I'm not sure what reason causes the problem, you
may solve it in another way:

Directly use SqlDataAdapter and SqlCommand to fill data to
DataTable (or DataTables, if the report requires multi-
tables), Then set data source of report:
rpt.Database.Tables[0].SetDataSource(table0);
..
rpt.Database.Tables.SetDataSource(tableI);

In this way, you don't need worry about Logon info any
more.

Hope it's helpful.

Elton Wang

(e-mail address removed)
 

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