Export (0) Print
Expand All
1 out of 5 rated this helpful - Rate this topic

Lesson 1: Creating the RDL Generator Visual Studio Project

For this tutorial, you will create a simple console application. This tutorial assumes that you are developing in Microsoft Visual Studio.

To create a console application

  1. On the File menu, point to New, and then click Project to open the New Project dialog box.

  2. Click either Visual Basic or the Visual C# node in the Project types pane.

  3. Click the Console Application icon.

  4. In the Name box, enter a name for your project. Type the name SampleRDLGenerator.

  5. In the Location box, enter the path where you want to save your project, or click Browse to navigate to the folder.

  6. Click OK. A collapsed view of your project appears in Solution Explorer.

    In Solution Explorer, expand the project node. A code file with the default name of Program.cs (Module1.vb for Visual Basic) has been added to your project.

When you have finished creating the application template, replace the contents of the code file with the following:

using System;
using System.Collections;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Text;
using System.Xml;

namespace SampleRDLGenerator
{
   class RdlGenerator
   {
      SqlConnection m_connection;
      string m_connectString;
      string m_commandText;
      ArrayList m_fields;

      public static void Main()
      {
         RdlGenerator myRdlGenerator = new RdlGenerator();
         myRdlGenerator.Run();
      }

      public void Run()
      {
         try
         {
            // Call methods to create the RDL
            this.OpenConnection();
            this.GenerateFieldsList();
            this.GenerateRdl();

            Console.WriteLine("RDL file generated successfully.");
         }

         catch (Exception exception)
         {
            Console.WriteLine("An error occurred: " + exception.Message);
         }

         finally
         {
            // Close the connection string
            m_connection.Close();
         }
      }

      public void OpenConnection()
      {
         // TODO: Open a connection to the sample database
      }

      public void GenerateFieldsList()
      {
         // TODO: Generate a list of fields for a report query
      }

      public void GenerateRdl()
      {
         // TODO: Generate RDL using XmlTextWriter
      }
   }
}

Tasks

Tutorial: Generating RDL Using the .NET Framework
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.