Export (0) Print
Expand All

Using FsiDataExtension

SQL Server 2000

Using FsiDataExtension

After you have compiled the sample data processing extension into Microsoft.Samples.ReportingServices.FsiDataExtension.dll and deployed it to a report server and to your Report Designer, you can author a report that uses the sample. For more information on authoring a sample report that uses the file share data processing extension, see Creating a Report for the Sample Data Processing Extension. You can also use a console application to test the data processing extension.

The following code sample contains a program that creates an instance of the sample FsiDataReader class.

Imports System
Imports Microsoft.Samples.ReportingServices.FsiDataExtension
Imports Microsoft.ReportingServices.DataProcessing

'/ <summary>
'/ A class that contains code for testing a data processing extension.
'/ </summary>

Class Sample
   
   'Entry point which delegates to C-style main Private Function
   Public Overloads Shared Sub Main()
      Main(System.Environment.GetCommandLineArgs())
   End Sub
   
   '/ <summary>
   '/ The main entry point for the application.
   '/ </summary>
   <STAThread()>  _
   Overloads Public Shared Sub Main(args() As String)
      Dim rowNumber As Integer = 0
      Try
         Dim conn As New FsiConnection()
         conn.Open()
         
         Dim cmd As New FsiCommand("\\MyFileShare\Public", conn)
         Dim reader As IDataReader = cmd.ExecuteReader()
         
         While reader.Read()
            Console.WriteLine("--- row {0} ---", rowNumber)
            Dim i As Integer
            For i = 0 To reader.FieldCount - 1
               Console.WriteLine("{0}: {1}", reader.GetName(i), reader.GetValue(i))
            Next i
            Console.WriteLine("--- end row ---" + ControlChars.Lf)
            rowNumber += 1
         End While
      
      Catch e As Exception
         Console.WriteLine(("Exception: " + e.Message))
      End Try
   End Sub 'Main
End Class 'Sample

using System;
using Microsoft.Samples.ReportingServices.FsiDataExtension;
using Microsoft.ReportingServices.DataProcessing;

namespace FsiDataExtensionTest
{
   /// <summary>
   /// A class that contains code for testing the sample data processing extension.
   /// </summary>
   class Sample
   {
      /// <summary>
      /// The main entry point for the application.
      /// </summary>
      [STAThread]
      public static void Main(string[] args)
      {
         int rowNumber = 0;
         try 
         {
            FsiConnection conn = new FsiConnection();
            conn.Open();
         
            FsiCommand cmd = new FsiCommand(@"\\MyFileShare\Public", conn);
            IDataReader reader = cmd.ExecuteReader();
                        
            while (reader.Read())
            {
               Console.WriteLine("--- row {0} ---", rowNumber);
               for (int i=0 ; i < reader.FieldCount; i++)
               {
                  Console.WriteLine("{0}: {1}", reader.GetName(i), reader.GetValue(i));
               }
               Console.WriteLine("--- end row ---\n");
               rowNumber++;
            }
         }
            
         catch(Exception e)
         {
            Console.WriteLine("Exception: " + e.Message);
         }
      }
   }
}
See Also

Implementing a Data Processing Extension

Sample File Share Data Processing Extension

Show:
© 2014 Microsoft