This is a migrated thread and some comments may be shown as answers.

Question by Scenario

2 Answers 72 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Thevodka
Top achievements
Rank 2
Thevodka asked on 05 Sep 2008, 01:45 AM
Hi,

My questions are how to apply the telerik Reporting with this Scenario.

  • We are developing the web application
  • We have 2 database servers development Database server and Production Database server
  • During development we will use the development database server when we deploy to Production will copy the website and change the connection string in web.config
  • Our developer able to design the report and preview in design time with the correct layout
  • After deploy the web application our developer don't have to change the database connection in the report manually it will use the connection string in web.config


After we try we got the problems below;

  • we can't preview the report if we using the connection string from the web.config have to use the wizard to generate the connection for us
  • if we use the wizard we don't know how to change the connection string manual at runtime
  • we need to recompile everything after change the connection string in the report when want to deploy to production server

The current solution

  • we are manual create the connection string by hardcode "see Code #1" it's give us the preview on design time

  • At runtime we rebind the data manual by take the connection string from web.config "see Code #2"  it's give us don't have to recompile the project when deploy to the server





below are the current source code we are using for the moment

    public partial class Report1 : Telerik.Reporting.Report  
    {  
        public Report1()  
        {  
            /// <summary> 
            /// Required for telerik Reporting designer support  
            /// </summary> 
            InitializeComponent();  
 
            sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();  
            sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter();  
            sqlConnection1 = new System.Data.SqlClient.SqlConnection();  
            sqlConnection1.ConnectionString =  
                "Data Source=Develop_telerik;Initial Catalog=insurance;Persist Security Info=True;User ID=sa;Password=rYnI@6%33$3kdnOOk";  
              
            sqlSelectCommand1.CommandText = "SELECT * FROM TelerikReport";  
            sqlSelectCommand1.Connection = sqlConnection1;  
            sqlDataAdapter1.SelectCommand = sqlSelectCommand1;  
            this.DataSource = sqlDataAdapter1;  
 
        }  
    }  

[Code #1]


above the code inside the report
It's gave us the preview in design time


         System.Data.SqlClient.SqlCommand sqlSelectCommand1;  
         System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;  
         System.Data.SqlClient.SqlConnection sqlConnection1;  
         Report1 _report1 = new Report1();  
 
         sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();  
         sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter();  
         sqlConnection1 = new System.Data.SqlClient.SqlConnection();  
         sqlConnection1.ConnectionString = ConfigurationManager.ConnectionStrings["TelerikConnectionString"].ToString();  
 
         sqlSelectCommand1.CommandText = "SELECT * FROM TelerikReport";  
         sqlSelectCommand1.Connection = sqlConnection1;  
         sqlDataAdapter1.SelectCommand = sqlSelectCommand1;  
 
         _report1.DataSource = sqlDataAdapter1;  
 
         ReportViewer1.Report = new Report1(); 

[Code #2]


above are the code in the ReportView page








Any ideas, to improve the development time or anyone has the sample project like this.

Kind Regards,
Kwan

2 Answers, 1 is accepted

Sort by
0
Accepted
Steve
Telerik team
answered on 08 Sep 2008, 12:06 PM
Hi Kwan,

The possible solutions are presented in the following code library project.

Kind regards,
Steve
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Thevodka
Top achievements
Rank 2
answered on 08 Sep 2008, 02:29 PM
Thank you so much..

Tags
General Discussions
Asked by
Thevodka
Top achievements
Rank 2
Answers by
Steve
Telerik team
Thevodka
Top achievements
Rank 2
Share this question
or