Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i... to all
i've created ssrs reports local following is my code..
public void source(string tbname,string Rptname)
        {
            ReportViewer1.Visible = true;
            string myQuery = "select * from " + tbname;
            SqlConnection myConnection = new SqlConnection(ConnectionString);
            SqlCommand myCommand = new SqlCommand(myQuery, myConnection);
            myCommand.Connection.Open();
            SqlDataAdapter da = new SqlDataAdapter(myCommand);
            DataSet dt = new DataSet();
            da.Fill(dt);


            //ReportParameter[] p = new ReportParameter[1];
            //p[1] = new ReportParameter("@p_dno", "5");
            //this.ReportViewer1.LocalReport.SetParameters(p);
            //DataSet dt = new DataSet();
            //dt = p;
            ReportViewer1.LocalReport.ReportPath = Rptname + ".rdlc" ;
            ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
           ReportDataSource datasource = new ReportDataSource("employeeDataSet_" + tbname , dt.Tables[0]);
            ReportViewer1.LocalReport.DataSources.Clear();
            ReportViewer1.LocalReport.DataSources.Add(datasource);
       
        }

now it works good..
as i expected...

but i want to pass the datasource connection string from here is there any
way to pass the datasource programatically....
Posted
Updated 19-Oct-10 22:41pm
v2
Comments
Hiren solanki 20-Oct-10 4:41am    
added 'pre' tags for code visibility.
Hiren solanki 20-Oct-10 4:43am    
'I want to pass connection string from here', what could be 'here' here.?
Chris Meech 26-Nov-10 12:43pm    
Where is ConnectionString defined and how is it's value currently set?

1 solution

 
Share this answer
 

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