tags:

views:

14

answers:

0
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