Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 10045

Passing Parameters To Report Server Custom DataSet

$
0
0

Hi There,

I have a problem with debugging a custom datasource for a report.
I need to pass report parameters to the custom datasource, and I think I am doing it right, but obviously not as the result is not the desired result.

But I have not yet found a way how to check what parameters are actually being used by the custom datasource.
I want to pass "VarParms" to "_CommandText" of the custom datasource "GetData" sub and check the content.
How can I accomplish this?

'=========================================================================
'  File:      BaanstedeCdsReader.vb
'-------------------------------------------------------------------------
'  Summary:   Provides a means of reading one or more forward-only streams 
'    of result sets obtained by executing a command at a data source, 
'    and is implemented by Baanstede Data Processing Extensions 
'    that access BaanstedeIw3-routines.

'=========================================================================

'Imports System.Data.OleDb
Imports Microsoft.ReportingServices.DataProcessing
Imports Bst = BaanstedeCds.Baanstede
Imports BstSql = BaanstedeCds.BaanstedeSql
Imports BstAdo = BaanstedeCds.BaanstedeAdo
Imports System.Data.SqlClient

Public Class BaanstedeCdsReader
	Implements IDataReader

	Dim ProcId As Integer = Bst.ProcId
	Dim ParmProcId As Integer = Bst.ProcId

#Region "Variables"
	'============================================

	'The Instance Variables for the DataReader Class

	'============================================
	Private _Connection As BaanstedeCdsConnection
	Private _Command As String
	Private _CurrentRow As Integer = -1
	Private _DataTable As DataTable = New DataTable
#End Region


#Region "Constructors"
	'============================================

	'The Constructors for the DataReader Class

	'============================================
	Friend Sub New()
		'TODO: Implement the default constructor.
	End Sub

	Friend Sub New(ByVal cmdText As String)
		_Command = cmdText
	End Sub

	Friend Sub New(ByVal cmdText As String, ByVal connection As BaanstedeCdsConnection)
		_Connection = connection
		_Command = cmdText
	End Sub

#End Region

#Region "IDataReader Members"

	'==============================================

	'The Implementation of IDataReader Members

	'==============================================

	'Returns the total number of columns. Gets the number of fields in the data reader.
	Public ReadOnly Property FieldCount() As Integer Implements IDataReader.FieldCount
		Get
			Return _DataTable.Columns.Count
		End Get
	End Property

	'Gets the Type information corresponding to the type of object that is returned from GetValue.
	'Returns the Datatype of the current column.
	Public Function GetFieldType(ByVal fieldIndex As Integer) As System.Type Implements IDataReader.GetFieldType
		Return (_DataTable.Columns(fieldIndex).DataType)
	End Function

	'Gets the name of the field to find.
	Public Function GetName(ByVal fieldIndex As Integer) As String Implements IDataReader.GetName
		Return (_DataTable.Columns(fieldIndex).ColumnName)
	End Function

	'Return the index of the named field.
	Public Function GetOrdinal(ByVal fieldName As String) As Integer Implements IDataReader.GetOrdinal
		Return _DataTable.Columns(fieldName).Ordinal
	End Function

	'Return the value of the specified field.
	Public Function GetValue(ByVal fieldIndex As Integer) As Object Implements IDataReader.GetValue
		Return (_DataTable.Rows(_CurrentRow)(fieldIndex))
	End Function

	'Reads one row after the other. Advances the IDataReader to the next record.
	'The DataReader object enables a client to retrieve a read-only, forward-only stream of data 
	'from a data source. Results are returned as the query executes and are stored in the network buffer 
	'on the client until you request them using the Read method of the DataReader class
	Public Function Read() As Boolean Implements IDataReader.Read
		_CurrentRow = _CurrentRow + 1
		If (_CurrentRow >= _DataTable.Rows.Count) Then
			Return (False)
		Else
			Return (True)
		End If

	End Function

#End Region


#Region "GetData Method"

	'We are executing the command using the connection string that connects to the Active Directory.
	'Hard coding of the connection string is because it is the same for all the ADs.
	'Once we read the data using a DataReader, we place the same in a DataTable so that can be used for
	'Other processings.
	'Public Sub GetData(ByVal _CommandText As String)

	Public Sub GetData(ByVal _CommandText As String)
		'--------------------------------
		'	Ophalen Data in _DataTable	'
		'--------------------------------
		Dim ParmName As String = ""
		Dim ParmValue As String = ""
		Try
			'	ViewData= in _CommandText?
			ParmName = "ViewData"
			If Not BstSql.GetParmValue(ProcId, _CommandText, ParmName, ParmValue) Then
				GoTo End_Sub
			End If
			If ParmValue <> "" Then
				'	Haal ViewData adv ViewData=<ParmValue>
				If Not GetView(_CommandText, ParmValue) Then
					GoTo End_Sub
				End If
				GoTo End_Sub
			End If
			'	Project= in _CommandText?
			ParmName = "Project"
			If Not BstSql.GetParmValue(ProcId, _CommandText, ParmName, ParmValue) Then
				GoTo End_Sub
			End If
			If ParmValue <> "" Then
				'	Haal MutatieData adv Project=<ParmValue>
				If Not GetAdoTrnData(_CommandText) Then
					GoTo End_Sub
				End If
				GoTo End_Sub
			End If
			'	PrjId= in _CommandText?
			ParmName = "PrjId"
			If Not BstSql.GetParmValue(ProcId, _CommandText, ParmName, ParmValue) Then
				GoTo End_Sub
			End If
			If ParmValue <> "" Then
				If Not Bst.IsDigits(ParmValue) Then
					Bst.FoutMsg(ProcId, "PrjId is niet numeriek: " & Bst.EdVal(ParmValue) & " uit: " & Bst.EdVal(_CommandText))
					GoTo End_Sub
				End If
				'	Haal MutatieData adv PrjId=<ParmValue>
				If Not GetAdoTrnData(_CommandText) Then
					GoTo End_Sub
				End If
				GoTo End_Sub
			End If
			'	Default Data
			Dim Dc As DataColumn = Nothing
			Dim Rw As DataRow = Nothing
			Dc = New DataColumn("PrsId", Type.GetType("Sys


I'll be back


Viewing all articles
Browse latest Browse all 10045

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>