4
Reply

Database Login

Pravin Ghadge

Pravin Ghadge

Nov 9 2011 1:10 PM
1.2k
Dear all.

I have created crystal report.
While opening crystal report through application it shows me Database Login Window.
I have used foll. code:
      string reppath = "";
                 con = oDAL.OpenConnection();
                 rd = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
           
                 string DOCENTRY = "";
                 ParameterFields myparam = new ParameterFields();
                 ParameterField param1 = new ParameterField();    
                 ParameterDiscreteValue dv1 = new ParameterDiscreteValue();
       
             
                 if (DocEntry != null)
                 {
                     DOCENTRY = DocEntry;
                 }
                 else
                 {
                     DOCENTRY = "";
                 }
                 con = oDAL.OpenConnection();    
                 param1.ParameterFieldName = "DocEntry";  

                 dv1.Value = DOCENTRY;
                 param1.CurrentValues.Add(dv1);
                 //myparam.Add(param1);
                 //myparam.Add(param2);
                 myparam.Add(param3);
                 crystalReportViewer1.ParameterFieldInfo = myparam;
                 reppath = oDAL.ReportPath + "\\" + ReportName;
                 //  reppath = Application.StartupPath+"\\Reports" + "\\" + ReportName; 
                 rd.Load(reppath);
                 rd.DataSourceConnections[0].SetConnection(oDAL.servername, oDAL.DatabaseName, oDAL.UserID, oDAL.UserPassword);

            
              
                 rd.SetParameterValue("DocEntry", DocEntry);

             
                 crystalReportViewer1.ShowGroupTreeButton = false;
                 crystalReportViewer1.ReportSource = rd;
                 crystalReportViewer1.Refresh();
                 crystalReportViewer1.BringToFront();
                 crystalReportViewer1.ShowCloseButton = true;

Answers (4)