none
Regarding creating RDLC without Datased(.xsd) RRS feed

  • Question

  • I have created a rdlc report in VS 2005 as below
    1.first i created a dataset .xsd
    2.Added a new report.rdlc  and draged and droped fields from the datasource (dataset.xsd) .
    3.Added and webpage(.aspx) and added reportviewer control.and set the report path through Reportviewer Tasks.

    It created a object  data source  control .which references the dataset_datatabel name.

    4.My report has a report parameter i am setting it as below

    Programmatically


      SqlConnection thisConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["ITPlanningConnectionString"].ConnectionString);
            System.Data.DataSet thisDataSet = new System.Data.DataSet();
            SqlCommand cmd = new SqlCommand("usp_SelectInformationTechBudget", thisConnection);
            SqlDataAdapter adpt = new SqlDataAdapter(cmd);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@AgencyID", SqlDbType.Int, 390).Value = 8;
            adpt.Fill(thisDataSet, "Parameters");
            DataTable dt = thisDataSet.Tables[0];

            string stragencyId = "8";
            ReportParameter[] parms = new ReportParameter[1];
            parms[0] = new ReportParameter("AgencyID", stragencyId);
            ReportViewer1.LocalReport.SetParameters(parms);
            if (dt != null)
            {
               ReportViewer1.LocalReport.DataSources.Clear();
                ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1_usp_SelectInformationTechBudget", dt));
                dt.Dispose();
            }   
            ReportViewer1.LocalReport.Refresh();

    At run time if i change the report parameter value ,the report show the proper result in the reportviewer control .every thing is working fine.


    My question is how to skip the part of creating Dataset.xsd and set the datasource of the report at runtime .
    Without creating the dataset.xsd ,how we can layout the report.rdlc

    Thanks for all ......



    Thursday, April 3, 2008 5:59 PM

Answers

  • yeah, the RDLC stores the datastructure,  so once you save the .RDLC file, it will keep itself intact.  You can change/delete the dataset.xsd all you want without directly effecting the .RDLC.

     

    For instance, my project has no dataset in it, just lots of .RDLC files and a reportviewer control. 

     

    I use a seperate project to design my reports in, that project has a .RDLC file, and I just swap out datatables in the dataset, and then bind the table to the .RDLC i'm working on.

     

    Hope this make sense

    Friday, April 4, 2008 4:53 PM

All replies

  • well, essentially you did it already, y ou don't need the dataset.xsd after you create the report, you can drop it all together.  The report stores the fields used to design it within it's xml, and the name of the datatables.  So at runtime, it just wants you to hand it a datasource with the same name as the one you designed it with. 

     

    Friday, April 4, 2008 1:18 PM
  • Thanks for your reply,

      Deleting the dataset.xsd will not create problem while deployment   to the test server or production server? Because report contains the references in it’s xml file .

    Or

    Is it fine to have the dataset.xsd while deployment?  Without deleting it.

    Friday, April 4, 2008 3:51 PM
  • yeah, the RDLC stores the datastructure,  so once you save the .RDLC file, it will keep itself intact.  You can change/delete the dataset.xsd all you want without directly effecting the .RDLC.

     

    For instance, my project has no dataset in it, just lots of .RDLC files and a reportviewer control. 

     

    I use a seperate project to design my reports in, that project has a .RDLC file, and I just swap out datatables in the dataset, and then bind the table to the .RDLC i'm working on.

     

    Hope this make sense

    Friday, April 4, 2008 4:53 PM

  • For one of my rdlc report  i need to read a word doc and display the content in text box .I am using the following code to read word document
    Which works fine .But it not preserving the formats .Like bold ,Underlined ,paragraph etc .....Is there any way to read word without loosing format and display the same in rdlc report text box.

    Thanks,


                Word.Application obj_app = new Word.ApplicationClass();
                Word.Document obj_doc = new Word.DocumentClass();
                object readOnly = false;
                object isVisible = true;
                object missing = System.Reflection.Missing.Value;
                object filepath = (@"c:\PrintedPlan.doc"); //file to be read
                obj_doc = obj_app.Documents.Open(ref filepath, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible, ref missing, ref missing, ref missing, ref missing);
                obj_doc.Select();
                string input = obj_app.Selection.FormattedText.Text;
                TextBox1.Text = input;

                ReportParameter[] parms = new ReportParameter[1];
                parms[0] = new ReportParameter("fx", input);
                ReportViewer1.LocalReport.SetParameters(parms);
                obj_doc.Close(ref missing, ref missing, ref missing);
                obj_app.Quit(ref missing, ref missing, ref missing);
    Wednesday, May 14, 2008 2:55 PM
  • I want to do something that I hope would be simple:

    I have a fully laid out .rdlc report that goes to the reportviewer, gets its data source and all that.

    Now for my .NET forms, a user can edit a config file to determine whether or not certain fields get hidden or not, including cooresponding labels (basically altering the visible property dynamically).

    How can I get the labels and fields on the report I've created to do the same thing?

    I've read all the Dynamic .RDLC stuff and it's pretty complicated, not to mention the sample vb code has arguments that I don't see when I try to duplicate it at the reportviewer level.

    Any feedback, or help?

    Daniel
    Tuesday, November 4, 2008 8:05 PM
  • Try adding report parameters for each config setting and then have the column (or whatever report item you need to hide) have it's hidden property set to an expression like =Parameters!HideThisColumn.Value. You can pass the config settings in with the LocalReport.SetParameters method.


    Nick Allen, Microsoft SQL Server Reporting Services. This posting is provided "AS IS" with no warranties and confers no rights.
    Saturday, November 8, 2008 5:51 AM
  •  I meet the same question.
    If I create a dataset in advance. That means I have create a connection string. But at run time I may connect to another server.
    Does it matter if I delete all dataset?
    You said the rdlc will hide the information in its inside xml.
    Tuesday, November 11, 2008 9:58 PM