Click here to Skip to main content
16,021,112 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Friends,

There is a login problem in my CRV(Crystal Reports Viewer).

The first time the crystal reports open it works completely OK.
But, when I go onto second page of crystal reports it shows Database login dialog.

I try to set property EnableDatabaseLogin to false but it not work properly.

I need also one help from you:-
Can you give how to display crystal reports large reports in crystal reports?

Can we apply any css for it?


thanks and regards,
Chirag :rose:
Posted
Updated 1-Nov-10 22:31pm
v2
Comments
Dalek Dave 2-Nov-10 4:30am    
Edited for Grammar and Syntax.

1 solution

Hi there, i had the same problem this how i managed to solve it. Pay attention to the first DataSet(getRpt) and how it is used within the following events 1.Page_init;2.Page_Load;3.CrystalReportViewr_Page_Init;4.CrystalReportViewrNavigate heres my Full code

MSIL
DataSet getRpt()
      {
              CrystalReport2 myRpt = new CrystalReport2();
              string myConstr = ConfigurationManager.AppSettings["ConnectionString"];
              SqlConnection myConnection = new SqlConnection(myConstr);
              SqlDataAdapter myAdapter = new SqlDataAdapter();
              DataSet3 myDataSet = new DataSet3();
              SqlCommand MyCommand = myConnection.CreateCommand();
          try
          {

              CrystalReportViewer1.DisplayGroupTree = false;
              CrystalReportViewer1.DisplayToolbar = true;

              MyCommand.CommandText = "ProcNamet";
              MyCommand.CommandType = CommandType.StoredProcedure;
              myAdapter.SelectCommand = MyCommand;

              myAdapter.SelectCommand.Parameters.Add(new SqlParameter("@myPara1",Convert.ToInt32(txtDays.Text)));
              myAdapter.SelectCommand.Parameters.Add(new SqlParameter("@myPara2", Convert.ToString(DropDownList1.SelectedValue)));
              myAdapter.SelectCommand.Parameters.Add(new SqlParameter("@myPara3", Convert.ToString(DropDownList2.SelectedValue)));

              myAdapter.Fill(myDataSet, "ProcName");
              myRpt.SetDataSource(myDataSet);
              CrystalReportViewer1.ReportSource = myRpt;
          }

          catch (Exception ex)
          {
              string strEX;
              strEX = ex.ToString();
          }
          return myDataSet;

      }

      private void Page_Init(object sender, EventArgs e)
      {
          if (!IsPostBack)
          {
              DataSet myD = getRpt();
          }
      }

      protected void Page_Load(object sender, EventArgs e)
      {
         if (!IsPostBack)
         {
             DataSet myD = getRpt();
         }
       
      }
      protected void btnPreview_Click(object sender, EventArgs e)
      {


          if (!IsPostBack)
          {
              DataSet myD = getRpt();

          }
      }

      protected void CrystalReportViewer1_Init(object sender, EventArgs e)
      {
          if (!IsPostBack)
          {
              DataSet myD = getRpt();
          }
      }

      protected void CrystalReportViewer1_Navigate(object source, CrystalDecisions.Web.NavigateEventArgs e)
      {
          if (!IsPostBack)
          {
              DataSet myD = getRpt();
          }
      }
 
Share this answer
 
v2
Comments
Dalek Dave 2-Nov-10 4:31am    
Edited your code block to give proper language definition.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900