Crystal report help please

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Raghu Raman

    Crystal report help please

    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.Fina lly 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:
    CrystalDecision s.CrystalReport s.Engine.LogOnE xception: Logon failed.

    --------------------My code----------------
    rpt_proc_auditl og rpt=new rpt_proc_auditl og();
    TableLogOnInfo loginfo=new TableLogOnInfo( );
    ConnectionInfo coninfo=new ConnectionInfo( );
    Database crDatabase;
    Tables crTables;
    //Table crTable;
    crDatabase=rpt. Database;
    coninfo.ServerN ame="TCMS";
    coninfo.UserID= "TCMS_DATA" ;
    coninfo.Passwor d="SOCOOL";
    coninfo.Databas eName ="TCMS_DATA" ;
    crDatabase=rpt. Database;
    crTables=crData base.Tables;
    foreach(Crystal Decisions.Cryst alReports.Engin e.Table crTable in
    crTables)
    {
    loginfo = crTable.LogOnIn fo;
    loginfo.Connect ionInfo = coninfo;
    crTable.ApplyLo gOnInfo(loginfo );
    }
    //rpt.SetDatabase Logon("TCMS_DAT A","SOCOOL","TC MS","TCMS_DATA" );
    rpt.SetParamete rValue("sDispla yLabel","Header ");
    rpt.SetParamete rValue("STABLEN AME","MASTERPHY S");
    rpt.SetParamete rValue("NPKID", Convert.ToInt16 ("3664"));
    CREP.ReportSour ce=rpt;
    --------------
    cOULD YOU PLEASE TELL ME THE MISTAKE I MADE.


    With thanks
    Raghu




    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
  • Elton Wang

    #2
    Crystal report help please

    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.Ta bles[0].SetDataSource( table0);
    ..
    rpt.Database.Ta bles[I].SetDataSource( tableI);

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

    Hope it's helpful.

    Elton Wang

    elton_wang@hotm ail.com
    [color=blue]
    >-----Original Message-----
    >Hi,
    >
    >am using crystal report in my c#.net
    >
    >The report was initially designed with the RDO Connection[/color]
    and uses the[color=blue]
    >stroed proc,This sp requires 4 parameters.In my c# web[/color]
    app , i simply[color=blue]
    >included the report(.rpt) file and made an object for[/color]
    that and am[color=blue]
    >passing the parameters.Fina lly it gives the error message[/color]
    as,[color=blue]
    >
    >LOGON FAILED.
    >
    >Description: An unhandled exception occurred during the[/color]
    execution of the[color=blue]
    >current web request. Please review the stack trace for[/color]
    more information[color=blue]
    >about the error and where it originated in the code.
    >
    >Exception Details:
    >CrystalDecisio ns.CrystalRepor ts.Engine.LogOn Exception:[/color]
    Logon failed.[color=blue]
    >
    >--------------------My code----------------
    >rpt_proc_audit log rpt=new rpt_proc_auditl og();
    >TableLogOnIn fo loginfo=new TableLogOnInfo( );
    >ConnectionIn fo coninfo=new ConnectionInfo( );
    >Database crDatabase;
    >Tables crTables;
    >//Table crTable;
    >crDatabase=rpt .Database;
    >coninfo.Server Name="TCMS";
    >coninfo.UserID ="TCMS_DATA" ;
    >coninfo.Passwo rd="SOCOOL";
    >coninfo.Databa seName ="TCMS_DATA" ;
    >crDatabase=rpt .Database;
    >crTables=crDat abase.Tables;
    >foreach(Crysta lDecisions.Crys talReports.Engi ne.Table[/color]
    crTable in[color=blue]
    >crTables)
    >{
    >loginfo = crTable.LogOnIn fo;
    >loginfo.Connec tionInfo = coninfo;
    >crTable.ApplyL ogOnInfo(loginf o);
    > }
    >//rpt.SetDatabase Logon[/color]
    ("TCMS_DATA","S OCOOL","TCMS"," TCMS_DATA");[color=blue]
    >rpt.SetParamet erValue("sDispl ayLabel","Heade r");
    >rpt.SetParamet erValue("STABLE NAME","MASTERPH YS");
    >rpt.SetParamet erValue("NPKID" ,Convert.ToInt1 6("3664"));
    >CREP.ReportSou rce=rpt;
    >--------------
    >cOULD YOU PLEASE TELL ME THE MISTAKE I MADE.
    >
    >
    >With thanks
    >Raghu
    >
    >
    >
    >
    >*** Sent via Developersdex http://www.developersdex.com[/color]
    ***[color=blue]
    >Don't just participate in USENET...get rewarded for it!
    >.
    >[/color]

    Comment

    Working...