<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ralf Eisenreich &#187; .Net</title>
	<atom:link href="http://sqlblog.de/blog/category/net/feed/" rel="self" type="application/rss+xml" />
	<link>http://sqlblog.de/blog</link>
	<description>SQLBlog.DE &#124; ..things to remember</description>
	<lastBuildDate>Tue, 24 Nov 2009 16:18:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>SSIS: Split Excel cell values into rows</title>
		<link>http://sqlblog.de/blog/2009/04/ssis-split-excel-cell-values-into-rows/</link>
		<comments>http://sqlblog.de/blog/2009/04/ssis-split-excel-cell-values-into-rows/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 14:26:42 +0000</pubDate>
		<dc:creator>Ralf</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[ssis]]></category>

		<guid isPermaLink="false">http://sqlblog.de/blog/?p=474</guid>
		<description><![CDATA[Here I would like to show you a solution for following problem. One source row coming from Excel contains several values within one column. Each one of these values should be reflected in a separate row in the data destination. So the basic problem is that there we have a &#8220;list column&#8221; whose contents should [...]]]></description>
			<content:encoded><![CDATA[<p>Here I would like to show you a solution for following problem.<br />
One source row coming from Excel contains several values within one column. Each one of these values should be reflected in a separate row in the data destination.<br />
So the basic problem is that there we have a &#8220;list column&#8221; whose contents should be result in separate rows.</p>
<p>To make the problem more complex: The number of values in the &#8220;list column&#8221; is variable and there is a second column which contains corresponding values.</p>
<p><strong>Excel Source</strong><br />
<div id="attachment_481" class="wp-caption aligncenter" style="width: 280px"><a href="http://sqlblog.de/blog/wp-content/uploads/2009/04/excel_sheet.png"><img src="http://sqlblog.de/blog/wp-content/uploads/2009/04/excel_sheet.png" alt="Excel Sheet" title="Excel Sheet" width="270" height="165" class="size-full wp-image-481" /></a><p class="wp-caption-text">Excel Sheet</p></div></p>
<p><strong>solution: SSIS Script Component</strong></p>
<p>To implement a solution for the problem we use the most adequate item &#8211; the Script Component.</p>
<ol>
<li> We start with a data flow task in our package and add an <em>OLE DB Excel Source</em> component (that returns the source data above).<br />
We can use following SQL statement:<br />
<code><br />
SELECT<br />
F1,F2,F3<br />
FROM<br />
[sheet1$B1:D5]<br />
</code><br />
The imported columns can be named as <code>KEY</code>, <code>PERSON</code>, <code>DEPARTMENT</code>.<br />
<div id="attachment_507" class="wp-caption aligncenter" style="width: 233px"><a href="http://sqlblog.de/blog/wp-content/uploads/2009/04/excel_source.png"><img class="size-full wp-image-507" title="Excel Source" src="http://sqlblog.de/blog/wp-content/uploads/2009/04/excel_source.png" alt="Excel Source" width="223" height="300" /></a><p class="wp-caption-text">Excel Source</p></div>
	</li>
<li> Then we add a <em>Derived Column</em> Component to the data flow as well.<br />
<div id="attachment_505" class="wp-caption aligncenter" style="width: 160px"><a href="http://sqlblog.de/blog/wp-content/uploads/2009/04/derived_column.png"><img src="http://sqlblog.de/blog/wp-content/uploads/2009/04/derived_column.png" alt="Derived Column" title="Derived Column" width="150" height="131" class="size-full wp-image-505" /></a><p class="wp-caption-text">Derived Column</p></div></p>
<p>In order to replace the CRs with commas we replace the imported columns with following formula:<br />
<code><br />
REPLACE(REPLACE(REPLACE(REPLACE(PERSON,"\n",",")," ",""),",,",","),",,",",")<br />
REPLACE(REPLACE(REPLACE(REPLACE(DEPARTMENT,"\n",",")," ",""),",,",","),",,",",")<br />
</code><br />
<div id="attachment_506" class="wp-caption aligncenter" style="width: 310px"><a href="http://sqlblog.de/blog/wp-content/uploads/2009/04/derived_column_settings.png"><img src="http://sqlblog.de/blog/wp-content/uploads/2009/04/derived_column_settings-300x218.png" alt="Derived Column Settings" title="Derived Column Settings" width="300" height="218" class="size-medium wp-image-506" /></a><p class="wp-caption-text">Derived Column Settings</p></div>
	</li>
<li>
As result we receive following list of elements:</p>
<ul>
<li> &#8211; -</li>
<li><em>row 1</em></li>
<li>PERSON: Mr. Wayne,Mr. Kent,Mr. Parker</li>
<li>DEPARTMENT: Heros/Batman,Heros/Superman,Heros/Spiderman</li>
<li> &#8211; -</li>
<li><em>row 2</em></li>
<li>PERSON: Mr. Kirk,Ms. Janeway</li>
<li>DEPARTMENT: StarTrek/Classic,StartTrek/Voyager</li>
<li> &#8211; -</li>
<li><em>row 3</em></li>
<li>PERSON: &#8220;Mr. Wrong&#8221;</li>
<li>DEPARTMENT: Wrong entry 1,Wrong entry 2</li>
<li> &#8211; -</li>
</ul>
</li>
<li> Now we add a Script Component to the data flow.<br />
When we are prompted to select the type of the component we choose <em>Transformation</em>.</p>
<p><div id="attachment_508" class="wp-caption aligncenter" style="width: 168px"><a href="http://sqlblog.de/blog/wp-content/uploads/2009/04/script_component.png"><img src="http://sqlblog.de/blog/wp-content/uploads/2009/04/script_component.png" alt="Script Component" title="Script Component" width="158" height="232" class="size-full wp-image-508" /></a><p class="wp-caption-text">Script Component</p></div>
	</li>
<li> Then we right-click on the <em>Script Component</em> and choose Edit. In the Script Transformation Editor dialog box we select all three columns to make them available as input columns. Now these column are available in the Script code.<br />
<div id="attachment_516" class="wp-caption aligncenter" style="width: 310px"><a href="http://sqlblog.de/blog/wp-content/uploads/2009/04/script_component_columns.png"><img src="http://sqlblog.de/blog/wp-content/uploads/2009/04/script_component_columns-300x260.png" alt="Script Component Columns" title="Script Component Columns" width="300" height="260" class="size-medium wp-image-516" /></a><p class="wp-caption-text">Script Component Columns</p></div>
	</li>
<li> Since the tranformation is going to produce more output rows than it receives input rows we have to mark the transformation as asynchronous. This is done by setting the <em>SynchronousInputID</em> property of the output to <em>None</em>.<br />
<div id="attachment_511" class="wp-caption aligncenter" style="width: 310px"><a href="http://sqlblog.de/blog/wp-content/uploads/2009/04/script_component_settings.png"><img src="http://sqlblog.de/blog/wp-content/uploads/2009/04/script_component_settings-300x212.png" alt="Script Component Settings" title="Script Component Settings" width="300" height="212" class="size-medium wp-image-511" /></a><p class="wp-caption-text">Script Component Settings</p></div>
	</li>
<li> Next, we have to specify the output columns that the output buffer will contain. So we select the transformation&#8217;s output and click <em>Add Column</em> and set the properties (column name and data type).<br />
<div id="attachment_510" class="wp-caption aligncenter" style="width: 310px"><a href="http://sqlblog.de/blog/wp-content/uploads/2009/04/script_component_input.png"><img src="http://sqlblog.de/blog/wp-content/uploads/2009/04/script_component_input-300x256.png" alt="Script Component Input / Output rows" title="Script Component Input / Output rows" width="300" height="256" class="size-medium wp-image-510" /></a><p class="wp-caption-text">Script Component Input / Output rows</p></div>
	</li>
<li>
Now we can add the code by clicking on the <em>Design Script button</em>.<br />
<div id="attachment_509" class="wp-caption aligncenter" style="width: 295px"><a href="http://sqlblog.de/blog/wp-content/uploads/2009/04/script_component_design.png"><img src="http://sqlblog.de/blog/wp-content/uploads/2009/04/script_component_design.png" alt="Script Component - Design Script" title="Script Component - Design Script" width="285" height="183" class="size-full wp-image-509" /></a><p class="wp-caption-text">Script Component - Design Script</p></div>
	</li>
<li>
Following Code is splitting our list of items into rows:<br />
<code><br />
' Variables<br />
Dim i As Integer = 0<br />
Dim itemList_PERSON As String = Row.PERSON<br />
Dim itemList_DEPARTMENT As String = Row.DEPARTMENT<br />
Dim delimiter As String = ','<br />
If Not (String.IsNullOrEmpty(itemList_PERSON) Or String.IsNullOrEmpty(itemList_DEPARTMENT)) Then<br />
Dim inputListArray_Wer() As String = itemList_PERSON.Split(New String() {delimiter}, StringSplitOptions.RemoveEmptyEntries)<br />
Dim inputListArray_Abt() As String = itemList_DEPARTMENT.Split(New String() {delimiter}, StringSplitOptions.RemoveEmptyEntries)<br />
If (inputListArray_Wer.Length = inputListArray_Abt.Length) Then<br />
' new rows<br />
For Each item As String In inputListArray_Wer<br />
With Output0Buffer<br />
.AddRow()<br />
.KEY = CInt(Row.KEY)<br />
.PERSON = item<br />
.DEPARTMENT = inputListArray_Abt(i).ToString()<br />
End With<br />
' increase counter<br />
i = i + 1<br />
Next<br />
Else<br />
' Filtered Rows<br />
With Output1Buffer<br />
.AddRow()<br />
.KEY = CInt(Row.KEY)<br />
.PERSON = Row.PERSON<br />
.DEPARTMENT = Row.DEPARTMENT<br />
End With<br />
End If<br />
End If<br />
</code><br />
The code shows that there are two outputs. Whenever a record set cannot be split or the columns <em>PERSON</em> and <em>DEPARTMENT</em> have a different number of itemss the rows is redirected to the second output (here <em>Output1</em>).
	</li>
<li>
In order to receive the output from the Script Component we add a <em>Union All Component</em>. Additionally we add two <em>Data Viewer Components</em>, since  we want to see the resulting outputs from the Script Component.<br />
<div id="attachment_502" class="wp-caption aligncenter" style="width: 295px"><a href="http://sqlblog.de/blog/wp-content/uploads/2009/04/data_flow_union_all.png"><img src="http://sqlblog.de/blog/wp-content/uploads/2009/04/data_flow_union_all-285x300.png" alt="Union ALL" title="Union ALL" width="285" height="300" class="size-medium wp-image-502" /></a><p class="wp-caption-text">Union ALL</p></div>
	</li>
<li>
Running the SSIS package will bring the following result.<br />
<div id="attachment_501" class="wp-caption aligncenter" style="width: 290px"><a href="http://sqlblog.de/blog/wp-content/uploads/2009/04/data_flow_complete.png"><img src="http://sqlblog.de/blog/wp-content/uploads/2009/04/data_flow_complete-280x300.png" alt="Data Flow completed" title="Data Flow completed" width="280" height="300" class="size-medium wp-image-501" /></a><p class="wp-caption-text">Data Flow completed</p></div>
	</li>
<li>
As we can see, the first DataViewer Component show us the <em>valid</em> rows produced by our Script Component.<br />
<div id="attachment_504" class="wp-caption aligncenter" style="width: 310px"><a href="http://sqlblog.de/blog/wp-content/uploads/2009/04/data_viewer_valid.png"><img src="http://sqlblog.de/blog/wp-content/uploads/2009/04/data_viewer_valid-300x120.png" alt="Data Viewer valid rows" title="Data Viewer valid rows" width="300" height="120" class="size-medium wp-image-504" /></a><p class="wp-caption-text">Data Viewer valid rows</p></div>
	</li>
<li>
The second DataViewer Component show us the <em>invalid</em> rows produced by our Script Component.<br />
<div id="attachment_503" class="wp-caption aligncenter" style="width: 310px"><a href="http://sqlblog.de/blog/wp-content/uploads/2009/04/data_viewer_invalid.png"><img src="http://sqlblog.de/blog/wp-content/uploads/2009/04/data_viewer_invalid-300x35.png" alt="Data Viewer invalid rows" title="Data Viewer invalid rows" width="300" height="35" class="size-medium wp-image-503" /></a><p class="wp-caption-text">Data Viewer invalid rows</p></div>
	</li>
</ol>
<p><strong>download</strong><br />
Of course I provide you the solution as <a href='http://sqlblog.de/blog/wp-content/uploads/2009/04/excel_split_column.zip'>download</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlblog.de/blog/2009/04/ssis-split-excel-cell-values-into-rows/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>T-SQL: Split column in several rows</title>
		<link>http://sqlblog.de/blog/2009/04/t-sql-split-column-in-several-rows/</link>
		<comments>http://sqlblog.de/blog/2009/04/t-sql-split-column-in-several-rows/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 14:10:39 +0000</pubDate>
		<dc:creator>Ralf</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[snippets]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://sqlblog.de/blog/?p=550</guid>
		<description><![CDATA[problem If I have a column with several values (separated by CR) which I need separated into rows then following solution can help: possible solution: T-SQL One possible solution using T-SQL is following statement. The function fn_Split returns all values in a list and the replace function converts the CR (carriage returns) to commas. SELECT [...]]]></description>
			<content:encoded><![CDATA[<p><strong>problem</strong><br />
If I have a column with several values (separated by CR) which I need separated into rows then following solution can help:</p>
<p><strong>possible solution: T-SQL</strong><br />
One possible solution using T-SQL is following statement.<br />
The function <code>fn_Split</code> returns all values in a list and the <code>replace</code> function converts the CR (carriage returns) to commas.</p>
<p><code><br />
SELECT<br />
[Key]<br />
,[b.Value]<br />
,[c.Value]<br />
FROM<br />
[dbo.TableExcel] AS a<br />
CROSS APPLY<br />
fn_Split(REPLACE(a.Persons, CHAR(10)+CHAR(13),','), ',') AS b<br />
CROSS APPLY<br />
fn_Split(REPLACE(a.Departments, CHAR(10)+CHAR(13),','), ',') AS c<br />
</code></p>
<p>The corresponding <code>fn_Split</code> function:<br />
<code><br />
CREATE FUNCTION [dbo].[fn_Split](@text nvarchar(max), @delimiter char(1) = ' ')<br />
RETURNS @Strings TABLE (<br />
position int IDENTITY PRIMARY KEY,<br />
value nvarchar(max)<br />
)<br />
AS<br />
BEGIN<br />
DECLARE @index int<br />
SET @index = -1<br />
WHILE (LEN(@text) &gt; 0)<br />
BEGIN<br />
SET @index = CHARINDEX(@delimiter , @text)<br />
IF (@index = 0) AND (LEN(@text) &gt; 0)<br />
BEGIN<br />
INSERT INTO @Strings VALUES (@text)<br />
BREAK<br />
END<br />
IF (@index &gt; 1)<br />
BEGIN<br />
INSERT INTO @Strings<br />
VALUES (LEFT(@text, @index - 1))<br />
SET @text = RIGHT(@text, (LEN(@text) - @index))<br />
END<br />
ELSE<br />
SET @text = RIGHT(@text, (LEN(@text) - @index))<br />
END<br />
RETURN<br />
END<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://sqlblog.de/blog/2009/04/t-sql-split-column-in-several-rows/feed/</wfw:commentRss>
		<slash:comments>215</slash:comments>
		</item>
		<item>
		<title>SSIS: Excel Import Column Data Types</title>
		<link>http://sqlblog.de/blog/2009/04/ssis-excel-import-column-data-types/</link>
		<comments>http://sqlblog.de/blog/2009/04/ssis-excel-import-column-data-types/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 08:39:59 +0000</pubDate>
		<dc:creator>Ralf</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[ssis]]></category>

		<guid isPermaLink="false">http://sqlblog.de/blog/?p=428</guid>
		<description><![CDATA[When Excel data is not coming into SSIS right, then do the following: use option &#8220;IMEX=1&#8221; in ConnectionString (Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\..\MyExcel.xls;Extended Properties="Excel 8.0;HDR=Yes;IMEX=1") modify registry setting &#8220;TypeGuessRows=8&#8221; to a much higher value use a sql statement to retrieve data (e.g. &#8220;SELECT * FROM [sheet1$A5:M2000]&#8220;) NOTE: The setting IMEX=1 tells the Excel driver to use Import mode. [...]]]></description>
			<content:encoded><![CDATA[<p>When Excel data is not coming into SSIS right, then do the following:</p>
<ol>
<li>use option &#8220;<code>IMEX=1</code>&#8221; in ConnectionString (<code>Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\..\MyExcel.xls;Extended Properties="Excel 8.0;HDR=Yes;IMEX=1"</code>)</li>
<li>modify registry setting &#8220;<code>TypeGuessRows=8</code>&#8221; to a much higher value</li>
<li>use a sql statement to retrieve data (e.g. &#8220;<code>SELECT * FROM [sheet1$A5:M2000]</code>&#8220;)</li>
</ol>
<p>NOTE: The setting <code>IMEX=1</code> tells the Excel driver to use <em>Import</em> mode. This mode reads the registry setting &#8220;<code>ImportMixedTypes=Text</code>&#8221; which forces mixed data to be converted to text. To achieve a more reliable column type recognition, the registry setting &#8220;<code>TypeGuessRows=8</code>&#8221; should be increased. By default the ISAM driver analyzes  the first eight rows and determines the column datatypes from this sampling. If the first analysed rows contain only numeric values, then setting <code>IMEX=1</code> will not convert this column datatype to Text &#8211; it will remain numeric.</p>
<p>ATTENTION: The IMEX setting has some other modes:</p>
<ul>
<li>0 is Export mode</li>
<li>1 is Import mode</li>
<li>2 is Linked mode (full update capabilities)</li>
</ul>
<p>Registry Setting Location:<br />
<code><br />
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\X.X\Engines\Excel<br />
</code></p>
<p><strong>supplement</strong><br />
If you experience following error the above described solution could fix it.<br />
1. An OLE DB error has occurred. Error code: 0x80040E21.<br />
2. Failed to retrieve long data for column &#8220;XYZ&#8221;.<br />
3. There was an error with output column &#8220;XYZ&#8221; (55488) on output &#8220;Excel Source Output&#8221; (109). The column status returned was: &#8220;DBSTATUS_UNAVAILABLE&#8221;.<br />
4. The &#8220;output column &#8220;XYZ&#8221;  (55488)&#8221; failed because error code 0xC0209071 occurred, and the error row disposition on &#8220;output column &#8220;XYZ&#8221; (55488)&#8221; specifies failure on error. An error occurred on the specified object of the specified component.<br />
5. [DTS.Pipeline] Error: The PrimeOutput method on component &#8220;Info Source&#8221; (101) returned error code 0xC0209029.  The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.<br />
6. [DTS.Pipeline] Error: Thread &#8220;SourceThread0&#8243; has exited with error code 0xC0047038. </p>
]]></content:encoded>
			<wfw:commentRss>http://sqlblog.de/blog/2009/04/ssis-excel-import-column-data-types/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MSB4019: WebApplication.targets not found</title>
		<link>http://sqlblog.de/blog/2009/03/msb4019-webapplicationtargets-not-found/</link>
		<comments>http://sqlblog.de/blog/2009/03/msb4019-webapplicationtargets-not-found/#comments</comments>
		<pubDate>Wed, 18 Mar 2009 12:32:38 +0000</pubDate>
		<dc:creator>Ralf</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[OpenSource]]></category>

		<guid isPermaLink="false">http://sqlblog.de/blog/?p=405</guid>
		<description><![CDATA[Der Fehler MSB4019: The imported project &#8220;C:\Program Files\MSBuild\Microsoft\VisualStudio\v8.0\WebApplications\Microsoft.WebApplication.targets&#8221; was not found. konnte bei mir wie folgt behoben werden: Prüfen, ob sich unter C:\Program Files\MSBuild\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets ein File befindet. Wenn ja, dann dieses an die erwartete Stelle kopieren. Wenn nicht, dann dieses herunterladen (Google).]]></description>
			<content:encoded><![CDATA[<p>Der Fehler</p>
<blockquote><p>MSB4019: The imported project &#8220;C:\Program Files\MSBuild\Microsoft\VisualStudio\v8.0\WebApplications\Microsoft.WebApplication.targets&#8221; was not found.</p></blockquote>
<p>konnte bei mir wie folgt behoben werden:</p>
<ol>
<li>Prüfen, ob sich unter C:\Program Files\MSBuild\Microsoft\VisualStudio\v<strong>9</strong>.0\WebApplications\Microsoft.WebApplication.targets ein File befindet.</li>
<li>Wenn ja, dann dieses an die erwartete Stelle kopieren. Wenn nicht, dann dieses herunterladen (Google).</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://sqlblog.de/blog/2009/03/msb4019-webapplicationtargets-not-found/feed/</wfw:commentRss>
		<slash:comments>185</slash:comments>
		</item>
		<item>
		<title>SSRS: Disable Reporting Services Cache in Preview Mode</title>
		<link>http://sqlblog.de/blog/2008/12/ssrs-disable-reporting-services-cache-in-preview-mode/</link>
		<comments>http://sqlblog.de/blog/2008/12/ssrs-disable-reporting-services-cache-in-preview-mode/#comments</comments>
		<pubDate>Mon, 08 Dec 2008 14:40:21 +0000</pubDate>
		<dc:creator>Ralf</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ssrs]]></category>

		<guid isPermaLink="false">http://sqlblog.de/blog/?p=382</guid>
		<description><![CDATA[How to disable caching in SQL Server Reporting Services for Visual Studio in Preview Mode? SQL Server 2005 Service Pack 1 brings a new feature: caching data in BIDS (Business Intelligence Development Studio) Report Designer. Following objects are cached: all the data query, parameter value and credentials for previewing a report. Sometimes this feature can [...]]]></description>
			<content:encoded><![CDATA[<p>How to disable caching in SQL Server Reporting Services for Visual Studio in Preview Mode?</p>
<p>SQL Server 2005 Service Pack 1 brings a new feature: caching data in BIDS (Business Intelligence Development Studio) Report Designer. Following objects are cached: all the data query, parameter value and  credentials for previewing a report. Sometimes this feature can be annoying, if changes in preview mode should be visible immediately.</p>
<p>In order to disable the caching feature, following key has to be added to the config file &#8216;<code>RSReportDesigner.config</code>&#8216;.</p>
<p>Key:<br />
<code>&lt;Add Key="CacheDataForPreview" value="False" /&gt;</code></p>
<p>Location:<br />
<code>C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\RSReportDesigner.config</code><br />
To clear the cache you can also delete the *.data cache file which is located in the report RDL directory.</p>
<div id="attachment_383" class="wp-caption alignnone" style="width: 164px"><img class="size-full wp-image-383" title="ssrs_data_files" src="http://sqlblog.de/blog/wp-content/uploads/2008/12/ssrs_data_files.png" alt="SSRS: Caching Files (Preview Mode)" width="154" height="146" /><p class="wp-caption-text">SSRS: Caching Files (Preview Mode)</p></div>
]]></content:encoded>
			<wfw:commentRss>http://sqlblog.de/blog/2008/12/ssrs-disable-reporting-services-cache-in-preview-mode/feed/</wfw:commentRss>
		<slash:comments>276</slash:comments>
		</item>
		<item>
		<title>ReportViewer: Pass Parameters to Remote Report</title>
		<link>http://sqlblog.de/blog/2008/08/reportviewer-pass-parameters-to-remote-report/</link>
		<comments>http://sqlblog.de/blog/2008/08/reportviewer-pass-parameters-to-remote-report/#comments</comments>
		<pubDate>Wed, 27 Aug 2008 07:13:30 +0000</pubDate>
		<dc:creator>Ralf</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[ssrs]]></category>

		<guid isPermaLink="false">http://sqlblog.de/blog/?p=367</guid>
		<description><![CDATA[How to pass parameters to ReportViewer Control displaying a remote report (SSRS): ReportParameter[] parameters = new ReportParameter[2]; protected void Page_Load(object sender, EventArgs e) { parameters[0] = new ReportParameter("wave_id", "28"); parameters[1] = new ReportParameter("mpc_id", "1530"); ReportViewer1.ServerReport.SetParameters(parameters); }]]></description>
			<content:encoded><![CDATA[<p>How to pass parameters to ReportViewer Control displaying a remote report (SSRS):</p>
<p><code>ReportParameter[] parameters = new ReportParameter[2];</code></p>
<p><code>protected void Page_Load(object sender, EventArgs e) {<br />
    parameters[0] = new ReportParameter("wave_id", "28");<br />
    parameters[1] = new ReportParameter("mpc_id", "1530");<br />
    ReportViewer1.ServerReport.SetParameters(parameters);<br />
}</code></p>
]]></content:encoded>
			<wfw:commentRss>http://sqlblog.de/blog/2008/08/reportviewer-pass-parameters-to-remote-report/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Editor: Visual Studio</title>
		<link>http://sqlblog.de/blog/2007/11/php-editor-visual-studio/</link>
		<comments>http://sqlblog.de/blog/2007/11/php-editor-visual-studio/#comments</comments>
		<pubDate>Fri, 30 Nov 2007 00:23:04 +0000</pubDate>
		<dc:creator>Ralf</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[visual studio]]></category>

		<guid isPermaLink="false">http://sqlblog.de/blog/index.php/2007/11/30/php-editor-visual-studio/</guid>
		<description><![CDATA[Ein sehr guter PHP Editor inklusive Debugging-, Deployment- und (Smarty)-Template-Unterstützung heißt VS.PHP von Jcx.Software. AuÃŸerdem gibt es 4 verschiedene Versionen: VS.Php Standalone Edition VS.Php for Visual Studio 2005 VS.Php for Visual Studio .Net 2003 VS.Php for Visual Studio .Net Besonders die Integration in Visual Studio ist sehr interessant. Das sagt Jcx.Software dazu: If you are [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://sqlblog.de/blog/wp-content/uploads/2007/11/vsphp.png" alt="VS.PHP" /></p>
<p>Ein sehr guter PHP Editor inklusive Debugging-, Deployment- und (Smarty)-Template-Unterstützung heißt <a href="http://www.jcxsoftware.com/jcx/vsphp/home">VS.PHP</a> von <a href="http://www.jcxsoftware.com">Jcx.Software</a>.</p>
<p>AuÃŸerdem gibt es 4 verschiedene Versionen:</p>
<ul>
<li>
<ol>VS.Php Standalone Edition</ol>
<ol>VS.Php for Visual Studio 2005</ol>
<ol>VS.Php for Visual Studio .Net 2003</ol>
<ol>VS.Php for Visual Studio .Net</ol>
</li>
</ul>
<p>Besonders die Integration in Visual Studio ist sehr interessant.</p>
<p>Das sagt Jcx.Software dazu:</p>
<blockquote><p>If you are a .Net developer you may wonder why VS.Php? Php is one of the most popular languages for developing web applications. In fact, the Php community has the largest pool of rich open source applications, frameworks and resources to make your development life easier. VS.Php lets those who enjoy using Visual Studio use their favorite IDE for Php development. VS.Php also provides many unique features by leveraging the Visual Studio IDE like Php/Javascript debugging.</p></blockquote>
<p>[Quelle: <a href="http://www.jcxsoftware.com">Jcx.Software</a>]</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlblog.de/blog/2007/11/php-editor-visual-studio/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>.Net-Snippets</title>
		<link>http://sqlblog.de/blog/2007/11/net-snippets/</link>
		<comments>http://sqlblog.de/blog/2007/11/net-snippets/#comments</comments>
		<pubDate>Thu, 29 Nov 2007 15:11:25 +0000</pubDate>
		<dc:creator>Ralf</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[VBA]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[snippets]]></category>

		<guid isPermaLink="false">http://sqlblog.de/blog/index.php/2007/11/29/net-snippets/</guid>
		<description><![CDATA[Unter .Net-Snippets findet man recht gute Lösungen. Sollte man immer mal besuchen, wenn man vor einem Problemchen steht. Außerdem gibt es noch ein nettes Firefox-Search-Plugin zur schnellen Suche.]]></description>
			<content:encoded><![CDATA[<p><a title="http://dotnet-snippets.de" href="http://dotnet-snippets.de"><img src="http://sqlblog.de/blog/wp-content/uploads/2007/11/net-snippets.jpg" alt=".Net-Snippets" /></a></p>
<p>Unter <a title="dotnet-snippets" href="http://dotnet-snippets.de">.Net-Snippets</a> findet man recht gute Lösungen. Sollte man immer mal besuchen, wenn man vor einem Problemchen steht.</p>
<p>Außerdem gibt es noch ein nettes <a title="http://dotnet-snippets.de/dns/ffplugin.aspx" href="http://dotnet-snippets.de/dns/ffplugin.aspx">Firefox-Search-Plugin</a> zur schnellen Suche.</p>
<p><img src="http://sqlblog.de/blog/wp-content/uploads/2007/11/net-snippets2.jpg" alt=".Net-Snippets" /></p>
]]></content:encoded>
			<wfw:commentRss>http://sqlblog.de/blog/2007/11/net-snippets/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>GridView: FindControl in Template</title>
		<link>http://sqlblog.de/blog/2007/11/gridview-findcontrol-in-template/</link>
		<comments>http://sqlblog.de/blog/2007/11/gridview-findcontrol-in-template/#comments</comments>
		<pubDate>Wed, 28 Nov 2007 11:51:58 +0000</pubDate>
		<dc:creator>Ralf</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[edititemtemplate]]></category>
		<category><![CDATA[findcontrol]]></category>
		<category><![CDATA[gridview]]></category>

		<guid isPermaLink="false">http://sqlblog.de/blog/index.php/2007/11/28/gridview-findcontrol-in-template/</guid>
		<description><![CDATA[Um ein erfolgreiches FindControl in einem EditItemTemplate umzusetzen, sollte folgender Code verwendet werden. In diesem Beispiel wird in einem GridView in einer editierbaren Zeile einer Textbox ein Wert (SelectedValue) aus einer DropDownList zugewiesen, sobald ein Button gedrückt wird. protected void btnSet_Click(object sender, EventArgs e) { TextBox txtPredecessorName = (TextBox)((Button)sender).Parent.FindControl("txtPredecessorName"); DropDownList ddKTPredecessors = (DropDownList)((Button)sender).Parent.FindControl("ddKTPredecessors"); txtPredecessorName.Text = [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://sqlblog.de/blog/wp-content/uploads/2007/11/template_edit.jpg" alt="EditItemTemplate" /></p>
<p>Um ein erfolgreiches FindControl in einem EditItemTemplate umzusetzen, sollte folgender Code verwendet werden. In diesem Beispiel wird in einem GridView in einer editierbaren Zeile einer Textbox ein Wert (SelectedValue) aus einer DropDownList zugewiesen, sobald ein Button gedrückt wird.</p>
<p><code><br />
protected void btnSet_Click(object sender, EventArgs e) {<br />
TextBox txtPredecessorName = (TextBox)((Button)sender).Parent.FindControl("txtPredecessorName");<br />
DropDownList ddKTPredecessors = (DropDownList)((Button)sender).Parent.FindControl("ddKTPredecessors");<br />
txtPredecessorName.Text = ddKTPredecessors.SelectedValue;<br />
}<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://sqlblog.de/blog/2007/11/gridview-findcontrol-in-template/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Server 2005: SP2 &amp; Feature Pack</title>
		<link>http://sqlblog.de/blog/2007/02/sql-server-2005-sp2-feature-pack/</link>
		<comments>http://sqlblog.de/blog/2007/02/sql-server-2005-sp2-feature-pack/#comments</comments>
		<pubDate>Tue, 20 Feb 2007 09:22:35 +0000</pubDate>
		<dc:creator>Ralf</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[feature pack]]></category>
		<category><![CDATA[sp2]]></category>

		<guid isPermaLink="false">http://ralf-eisenreich.de/blog/index.php/2007/02/20/sql-server-2005-sp2-feature-pack/</guid>
		<description><![CDATA[Nun gibt mittlerweile schon das zweite Service Pack für den SQL Server 2005. Vor allem die Anbindung von Office 2007 soll zu den Verbesserungen zählen. Ausserdem wurde ein Feature Pack released, dass die neusten Add-On-Komponenten sowie Datenbankkonnektoren (beispielsweise JDBC) enthält.]]></description>
			<content:encoded><![CDATA[<p>Nun gibt mittlerweile schon das <a href="http://www.microsoft.com/downloads/details.aspx?familyid=50B97994-8453-4998-8226-FA42EC403D17">zweite Service Pack</a> für den SQL Server 2005.</p>
<p>Vor allem die Anbindung von Office 2007 soll zu den Verbesserungen zählen.</p>
<p>Ausserdem wurde ein <a href="http://www.microsoft.com/downloads/details.aspx?familyid=50B97994-8453-4998-8226-FA42EC403D17">Feature Pack</a> released, dass die neusten Add-On-Komponenten sowie Datenbankkonnektoren (beispielsweise JDBC) enthält.</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlblog.de/blog/2007/02/sql-server-2005-sp2-feature-pack/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>SSIS: Package import error</title>
		<link>http://sqlblog.de/blog/2006/11/ssis-package-import-error/</link>
		<comments>http://sqlblog.de/blog/2006/11/ssis-package-import-error/#comments</comments>
		<pubDate>Thu, 16 Nov 2006 11:00:19 +0000</pubDate>
		<dc:creator>Ralf</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[import]]></category>
		<category><![CDATA[ssis]]></category>

		<guid isPermaLink="false">http://ralf-eisenreich.de/blog/index.php/2006/11/16/ssis-package-import-error/</guid>
		<description><![CDATA[Falls ein Fehler beim Importieren von SSIS-Paketen auftritt und der SQL Server nicht unter der Default-Instanz installiert ist, liegt das mit hoher Sicherheit an einem Konfigurationsfehler. In der Datei steht standardmäßig der Eintrag ., welcher in SERVER\instance geändert werden muss. Dann findet der Integration Service auch die richtige SQL-Instanz zum speichern von Paketen. Die Datei [...]]]></description>
			<content:encoded><![CDATA[<p>Falls ein Fehler beim Importieren von SSIS-Paketen auftritt und der SQL Server nicht unter der Default-Instanz installiert ist, liegt das mit hoher Sicherheit an einem Konfigurationsfehler.</p>
<p>In der Datei steht standardmäßig der Eintrag <code>.</code>, welcher in <code>SERVER\instance</code> geändert werden muss.</p>
<p>Dann findet der Integration Service auch die richtige SQL-Instanz zum speichern von Paketen.</p>
<p>Die Datei befindet sich unter <code>C:\Program Files\Microsoft SQL Server\90\DTS\Binn</code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlblog.de/blog/2006/11/ssis-package-import-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSIS: Fehlstart nach SP1</title>
		<link>http://sqlblog.de/blog/2006/11/ssis-fehlstart-nach-sp1/</link>
		<comments>http://sqlblog.de/blog/2006/11/ssis-fehlstart-nach-sp1/#comments</comments>
		<pubDate>Thu, 16 Nov 2006 07:25:53 +0000</pubDate>
		<dc:creator>Ralf</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[sp1]]></category>
		<category><![CDATA[ssis]]></category>

		<guid isPermaLink="false">http://ralf-eisenreich.de/blog/index.php/2006/11/16/ssis-fehlstart-nach-sp1/</guid>
		<description><![CDATA[error 1053 integration services Falls ein Fehlstart der SSIS nach der Installation des Service Pack 1 für den SQL-Server auftritt, dann kann es daran liegen, dass der direkte Internetzugang geblockt wird. Entweder Firewall konfigurieren oder dem System die aktuellen Proxy-Einstellungen mitteilen. Den Proxy konfiguriert man dann in der Eingabeaufforderung mit dem Tool proxycfg.exe. [Quelle: MS [...]]]></description>
			<content:encoded><![CDATA[<p><strong>error 1053 integration services</strong></p>
<p>Falls ein Fehlstart der SSIS nach der Installation des Service Pack 1 für den SQL-Server auftritt, dann kann es daran liegen, dass der direkte Internetzugang geblockt wird.</p>
<p>Entweder Firewall konfigurieren oder dem System die aktuellen Proxy-Einstellungen mitteilen.</p>
<p>Den Proxy konfiguriert man dann in der Eingabeaufforderung mit dem Tool <code>proxycfg.exe</code>.</p>
<p>[Quelle: <a href="http://support.microsoft.com/kb/918644">MS Knowledge</a>]</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlblog.de/blog/2006/11/ssis-fehlstart-nach-sp1/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>SSIS: Paket aus .NET starten</title>
		<link>http://sqlblog.de/blog/2006/11/ssis-paket-aus-net-starten/</link>
		<comments>http://sqlblog.de/blog/2006/11/ssis-paket-aus-net-starten/#comments</comments>
		<pubDate>Tue, 14 Nov 2006 10:12:15 +0000</pubDate>
		<dc:creator>Ralf</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[ssis]]></category>

		<guid isPermaLink="false">http://ralf-eisenreich.de/blog/index.php/2006/11/14/ssis-paket-aus-net-starten/</guid>
		<description><![CDATA[Um ein SSIS-Paket, dass im SSIS-Storage des SQL-Servers (nicht im FileSystem) abgelegt ist aus einer .NET-Anwendung zu starten kann folgender Code verwendet werden: PLAIN TEXT Visual Basic: Protected Sub btnStart_Click&#40;ByVal sender As Object, ByVal e As System.EventArgs&#41; Handles btnStart.Click &#160; &#160; Dim pkg As New Package &#160; &#160; Dim app As New Application &#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Um ein SSIS-Paket, dass im SSIS-Storage des SQL-Servers (nicht im FileSystem) abgelegt ist aus einer .NET-Anwendung zu starten kann folgender Code verwendet werden:</p>
<p><span id="more-144"></span></p>
<div class="igBar"><span id="lvb-2"><a href="#" onclick="javascript:showPlainTxt('vb-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Visual Basic:</span>
<div id="vb-2">
<div class="vb">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Protected <span style="color: #b1b100;">Sub</span> btnStart_Click<span style="color:#006600; font-weight:bold;">&#40;</span>ByVal sender <span style="color: #b1b100;">As</span> Object, ByVal e <span style="color: #b1b100;">As</span> System.<span style="color: #66cc66;">EventArgs</span><span style="color:#006600; font-weight:bold;">&#41;</span> Handles btnStart.<span style="color: #66cc66;">Click</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">Dim</span> pkg <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">New</span> Package</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">Dim</span> app <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">New</span> Application</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">Dim</span> pkgResults <span style="color: #b1b100;">As</span> DTSExecResult</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; pkg = app.<span style="color: #66cc66;">LoadFromSqlServer</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">"\\PAKET_NAME"</span>, <span style="color: #ff0000;">"SERVER_NAME"</span>, <span style="color: #ff0000;">"USER"</span>, <span style="color: #ff0000;">"PASSWORD"</span>, <span style="color: #b1b100;">Nothing</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; pkgResults = pkg.<span style="color: #66cc66;">Execute</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; Console.<span style="color: #66cc66;">WriteLine</span><span style="color:#006600; font-weight:bold;">&#40;</span>pkgResults<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">End</span> <span style="color: #b1b100;">Sub</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Achtung: Die Referenz <code>Imports Microsoft.SqlServer.Dts.Runtime</code> muss hinzugefÃ¼gt werden!</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlblog.de/blog/2006/11/ssis-paket-aus-net-starten/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASP.NET: local ReportViewer</title>
		<link>http://sqlblog.de/blog/2006/11/aspnet-local-reportviewer/</link>
		<comments>http://sqlblog.de/blog/2006/11/aspnet-local-reportviewer/#comments</comments>
		<pubDate>Tue, 14 Nov 2006 09:49:46 +0000</pubDate>
		<dc:creator>Ralf</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[reportviewer]]></category>
		<category><![CDATA[visual studio]]></category>

		<guid isPermaLink="false">http://ralf-eisenreich.de/blog/index.php/2006/11/14/aspnet-local-reportviewer/</guid>
		<description><![CDATA[Der lokale ReportViewer und die Verwendung von Parametern Mit Visual Studio 2005 sowie Web Developer Express Studio wird das ReportViewer-Control mitgeliefert. Dieses Steuerelement kann in .NET-Anwendungen verwendet werden und unterstützt die Darstellung von Berichten, die in Report Definition Language definiert werden. Außerdem kann der ReportViewer Daten filtern, sortieren, gruppieren oder aggregieren. Die Datenpräsentation kann in [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Der lokale ReportViewer und die Verwendung von Parametern</strong></p>
<p>Mit Visual Studio 2005 sowie Web Developer Express Studio wird das ReportViewer-Control mitgeliefert. Dieses Steuerelement kann in .NET-Anwendungen verwendet werden und unterstützt die Darstellung von Berichten, die in Report Definition Language definiert werden. Außerdem kann der ReportViewer Daten filtern, sortieren, gruppieren oder aggregieren. Die Datenpräsentation kann in Listen, Tabellen, Diagrammen und Matrizen erfolgen. Sogar das Conditional Formatting ist möglich. Besonders hilfreich ist die Möglichkeit, Berichte in verschiedene Formate wie PDF oder Excel zu exportieren.</p>
<p>Ein in eine ASP.NET-Anwendung integrierter Bericht könnte so aussehen:<br />
<a class="imagelink" title="ReportViewer Example" href="http://ralf-eisenreich.de/blog/wp-content/uploads/2006/11/reportviewer-example.png"><img id="image145" src="http://ralf-eisenreich.de/blog/wp-content/uploads/2006/11/reportviewer-example.thumbnail.png" alt="ReportViewer Example" /></a></p>
<p>Die Daten für diese Berichte können von jeder Datenquelle kommen. Die Anwendung in der der ReportViewer eingebettet wird ist für die Bereitstellung der Daten zuständig. Daten müssen dem ReportViewer nur in der Form von ADO.NET DataTables oder einer Sammlung von Business Objekten übergeben werden.</p>
<p><span id="more-143"></span></p>
<p>Hat man auf seinem Server neben dem IIS, ASP.NET auch den ReportServer (eine Erweiterung des SQL-Server 2005) installiert, kann man Remote-Berichte in dieses Steuerelement einbetten, die dann vom ReportServer bereitgestellt und generiert werden. Als Zugabe gibt es einen Wizard, der die Erstellung von Berichten unterstützt und weitere Export-Formate wie TIFF, CSV usw.</p>
<p>Als Alternative bietet sich das Einbetten lokaler Berichte an. Dazu übergibt man dem in der eigenen Anwendung eingebetteten ReportViewer einen lokal abgelegten Bericht. Lokale Berichte tragen die Dateiendung RDLC (Report Definition Language Client-Side).</p>
<p>Besonders hilfreich ist die Verwendung von Parametern, um Daten in einem Bericht eingrenzen zu können. Bei der Verwendung von Remote-Berichten kann man Parameter direkt bei der Erstellung des Berichts definieren. Beim Aufruf wird dann eine Parameter-Maske eingeblendet, die eine Veränderung der Parameter ermöglicht.<br />
Bei der Verwendung lokaler Berichte gibt es diese Parameter-Maske leider nicht. Auch wenn man direkt im Bericht Parameter definiert hat, wird diese Maske nicht eingeblendet. Es macht also keinen Sinn bei lokalen Berichten Parameter zu definieren. Vielmehr ist es hier dann die Aufgabe der Anwendung, die die Daten bereitstellt, eine Filtermöglichkeit bereitzustellen.</p>
<p>In folgende Schritten kann man einen lokalen Bericht in einem ASP.NET-Projekt hinzufügen:</p>
<ul>
<li>Ein Datasets im Verzeichnis App_Code erstellen.<br />
Im Dataset einen TableAdapter hinzufügen, der die gewünschten Daten bereitstellt. In der Abfrage können auch Parameter definiert werden.</li>
<li>Einen Report erstellen im Verzeichnis App-Data.<br />
In Visual Studio kann der Report per Drag and Drop zusammengeklickt werden, wobei das vorher erstellte Dataset in der Toolbox angezeigt wird.</li>
<li>In einer ASP.NET-Seite den ReportViewer hinzufügen und den erstellten Bericht übergeben. Danach muss noch die ObjectDataSource konfiguriert werden, die erstellt wird sobald ein Bericht im ReportViewer ausgewählt wird oder Rebind gewählt wird.</li>
<li>Falls Parameter im Bericht verwendet werden sollen, muss das gewünschte Steuerelement (z.B. eine Textbox oder eine ComboBox) zu der ASP.NET-Seite hinzugefügt werden. In dem Page_Load-Ereignis wird dann folgender Code definiert:</li>
</ul>
<div class="igBar"><span id="lvb-4"><a href="#" onclick="javascript:showPlainTxt('vb-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Visual Basic:</span>
<div id="vb-4">
<div class="vb">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080;">' set default value for the data source</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ObjectDataSource1.<span style="color: #66cc66;">SelectParameters</span>.<span style="color: #66cc66;">Item</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">"month"</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color: #66cc66;">DefaultValue</span> = cboMonth.<span style="color: #66cc66;">SelectedValue</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080;">' show / hide report viewer</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">Dim</span> dv <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">New</span> Data.<span style="color: #66cc66;">DataView</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">dv = ObjectDataSource1.<span style="color: #66cc66;">Select</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">If</span> dv.<span style="color: #66cc66;">Table</span>.<span style="color: #66cc66;">Rows</span>.<span style="color: #66cc66;">Count</span>&amp;gt; <span style="color: #cc66cc;color:#800000;">0</span> <span style="color: #b1b100;">Then</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ReportViewer1.<span style="color: #66cc66;">Visible</span> = <span style="color: #b1b100;">True</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">Else</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ReportViewer1.<span style="color: #66cc66;">Visible</span> = <span style="color: #b1b100;">False</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">End</span> <span style="color: #b1b100;">If</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080;">' Live-Filter</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">If</span> chkFilter.<span style="color: #66cc66;">Checked</span> = <span style="color: #b1b100;">True</span> <span style="color: #b1b100;">Then</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ObjectDataSource1.<span style="color: #66cc66;">FilterExpression</span> = <span style="color: #b1b100;">String</span>.<span style="color: #b1b100;">Format</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">"(month = '{0}')"</span>, cboYear.<span style="color: #66cc66;">SelectedValue</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">Else</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ObjectDataSource1.<span style="color: #66cc66;">FilterExpression</span> = <span style="color: #ff0000;">""</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">End</span> <span style="color: #b1b100;">If</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ReportViewer1.<span style="color: #66cc66;">LocalReport</span>.<span style="color: #66cc66;">Refresh</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Bei der Verwendung von Parametern bei der Datenabfrage im Dataset wird in der ObjectDataSource (die Datenquelle für den ReportViewer) ein Default-Parameter definiert, der dann an die Select-Anweisung der Abfrage im Dataset übergeben wird.<br />
Möchte man von einem Steuerelement Daten übergeben, kann auch auf diesem Weg erfolgen.<br />
Mit Hilfe des DataView-Elements wird überprüft, ob die ObjectDataSource überhaupt Daten zurückgibt, wobei dann je nach Ergebnis der ReportViewer angezeigt wird oder nicht.<br />
Im Beispielcode wurde eine ComboBox für die Auswahl des Monats (cboMonth) verwendet.</p>
<p>Möchte man sozusagen live Daten Filtern, kann dies über die FilterExpression in der ObjectDataSource erfolgen. Dazu werden zunächst alle Daten im Dataset geladen und später in der ObjectDataSource vor der Ãœbergabe an den ReportViewer gefiltert. bei dieser Methode müssen keine Parameter in der Select-Anweisung definiert werden. Allerdings wird die Abfragedauer höher sein, da immer alle Daten aus der Datenbank geholt werden.<br />
Im Beispielcode wurde eine ComboBox fÃ¼r die Auswahl des Jahrs (cboYear) verwendet.</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlblog.de/blog/2006/11/aspnet-local-reportviewer/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>ASP.NET: Grid confirm delete</title>
		<link>http://sqlblog.de/blog/2006/11/aspnet-grid-confirm-delete/</link>
		<comments>http://sqlblog.de/blog/2006/11/aspnet-grid-confirm-delete/#comments</comments>
		<pubDate>Tue, 14 Nov 2006 08:39:41 +0000</pubDate>
		<dc:creator>Ralf</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[delete]]></category>
		<category><![CDATA[gridview]]></category>

		<guid isPermaLink="false">http://ralf-eisenreich.de/blog/index.php/2006/11/14/aspnet-grid-confirm-delete/</guid>
		<description><![CDATA[Merke: Um das Löschen eines Eintrags in einem GridView-Control bestätigen zu lassen, müssen vorher unter Edit Columns alle CommandField-Elemente manuell zum GridView hinzugefügt werden und danach das Delete-Element in ein Template-Field konvertiert werden. Nun ist es möglich diesem Element die Eigenschaft OnClientClick zu übergeben. Da kommt dann einfach das rein: OnClientClick="return confirm('Are you sure to [...]]]></description>
			<content:encoded><![CDATA[<p>Merke: Um das Löschen eines Eintrags in einem GridView-Control bestätigen zu lassen, müssen vorher unter <em>Edit Columns</em> alle <em>CommandField-Elemente</em> manuell zum GridView hinzugefügt werden und danach das Delete-Element in ein Template-Field konvertiert werden. Nun ist es möglich diesem Element die Eigenschaft <code>OnClientClick</code> zu übergeben.</p>
<p>Da kommt dann einfach das rein:</p>
<p><code>OnClientClick="return confirm('Are you sure to delete this element?');"</code></p>
]]></content:encoded>
			<wfw:commentRss>http://sqlblog.de/blog/2006/11/aspnet-grid-confirm-delete/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
