i am facing some problem while passing parameter to crystal report? it is asking for the password of

Posted by Gaurav Sharma on Stack Overflow See other posts from Stack Overflow or by Gaurav Sharma
Published on 2010-06-10T14:43:45Z Indexed on 2010/06/10 15:02 UTC
Read the original article Hit count: 500

Filed under:
|
|
protected void Page_Load(object sender, EventArgs e)
{               
    ConnectionInfo myConnectionInfo = new ConnectionInfo();
    myConnectionInfo.UserID = "sa";
    myConnectionInfo.Password = "********";
    setDBLOGONforREPORT(myConnectionInfo);


    //When i don't write this code it does not ask for the passowrd

//but doesn't take Parameter as value

    int recpt_no = Convert.ToInt32(Request.QueryString["recpt_no"]);
    ReportDocument report1 = new ReportDocument();
    //report1.SetDatabaseLogon("sa", "********");
    report1.Load(Server.MapPath("purchase.rpt"));
    report1.FileName = Server.MapPath("purchase.rpt");
    report1.SetParameterValue("recpt_no", recpt_no);
    CrystalReportViewer1.ReportSource = report1; 
}

private void setDBLOGONforREPORT(ConnectionInfo myconnectioninfo)
{

   TableLogOnInfos mytableloginfos = new TableLogOnInfos();
   mytableloginfos = CrystalReportViewer1.LogOnInfo;
   foreach (TableLogOnInfo myTableLogOnInfo in mytableloginfos)
   {
     myTableLogOnInfo.ConnectionInfo = myconnectioninfo;
   }

}

kindly Help me as soon as possible respt_no is passed as querysting Gaurav Sharma

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET