<?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>Biggle&#039;s Blog &#187; SQL</title>
	<atom:link href="http://www.biggle.de/blog/tag/sql-development/feed" rel="self" type="application/rss+xml" />
	<link>http://www.biggle.de/blog</link>
	<description>Web- und Software Development</description>
	<lastBuildDate>Tue, 07 Feb 2012 13:08:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Connectionstring ermitteln &#8211; The simplest way</title>
		<link>http://www.biggle.de/blog/connectionstring-ermitteln-the-simplest-way</link>
		<comments>http://www.biggle.de/blog/connectionstring-ermitteln-the-simplest-way#comments</comments>
		<pubDate>Sun, 01 Aug 2010 09:19:57 +0000</pubDate>
		<dc:creator>Mario Priebe</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Tipps]]></category>

		<guid isPermaLink="false">http://www.biggle.de/blog/?p=5053</guid>
		<description><![CDATA[Der wohl einfachste Weg einen Connectionstring zu ermitteln und dabei noch den String verifizieren, kann man durch folgende Verfahrensweise. (Voraussetzung Visual Studio &#038; SQL Server Management Studio (SSMS) Man legt sich an einem Ort seiner Wahl ein File mit der Extension *.udl an z.B. conn.udl und klickt dieses File doppelt. Hier kann man nun den Server und [...]]]></description>
			<content:encoded><![CDATA[<p>Der wohl einfachste Weg einen Connectionstring zu ermitteln und dabei noch den String verifizieren, kann man durch folgende Verfahrensweise. (Voraussetzung Visual Studio &#038; SQL Server Management Studio (SSMS)</p>
<p>Man legt sich an einem Ort seiner Wahl ein File mit der Extension <strong>*.udl</strong> an z.B. conn.udl und klickt dieses File doppelt. Hier kann man nun den Server und die Datenbank auswählen, die man im Connectionstring benötigt. Unter Provider noch den richtigen DB-Provider festlegen und zum Schluss mit OK bestätigen.</p>
<p><a href="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5iaWdnbGUuZGUvYmxvZy93cC1jb250ZW50L3VwbG9hZHMvMjAxMC8wOC91ZGwuY29ubmVjdGlvbnN0cmluZy5wbmc="><img class="alignnone size-full wp-image-5054" title="udl.connectionstring" src="http://www.biggle.de/blog/wp-content/uploads/2010/08/udl.connectionstring.png" alt="" width="437" height="504" /></a></p>
<p>Voila, öffnent man sein *.udl file nun mit dem Editor, findet man dort seinen Connnectionstring : )</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009900;">&#91;</span>oledb<span style="color: #009900;">&#93;</span>
<span style="color: #339933;">;</span> Everything after this line is an OLE DB initstring
Provider<span style="color: #339933;">=</span>SQLOLEDB<span style="color: #339933;">.</span>1<span style="color: #339933;">;</span>Integrated Security<span style="color: #339933;">=</span>SSPI<span style="color: #339933;">;</span>Persist Security Info<span style="color: #339933;">=</span><span style="color: #009900; font-weight: bold;">False</span><span style="color: #339933;">;</span>Initial Catalog<span style="color: #339933;">=</span>tempdb<span style="color: #339933;">;</span>Data Source<span style="color: #339933;">=</span>SX<span style="color: #339933;">-</span>PC\sqlexpress</pre></td></tr></table></div>

<hr /><p style="float:right; font-size:0.9em;">Dieser Beitrag stammt von <a href="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5iaWdnbGUuZGU=">Mario Priebe</a>.</p> <img src="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=5053" width="1" height="1" style="display: none;" /><h2  class="related_post_title">Ähnliche Beiträge</h2><ul class="related_post"><li>19. Dezember 2009 -- <a href="http://www.biggle.de/blog/verteilte-datenbankabfragen" title="Verteilte Datenbankabfragen">Verteilte Datenbankabfragen</a></li><li>31. Juli 2011 -- <a href="http://www.biggle.de/blog/gottmodus-in-windows-7-aktivieren" title="Gottmodus in Windows 7 aktivieren">Gottmodus in Windows 7 aktivieren</a></li><li>4. Juli 2011 -- <a href="http://www.biggle.de/blog/neuer-ordner-im-projekt-per-hotkey" title="Neuer Ordner im Projekt per Hotkey">Neuer Ordner im Projekt per Hotkey</a></li><li>25. Juni 2011 -- <a href="http://www.biggle.de/blog/enumeration-in-einer-combobox-darstellen-wpf-quicky" title="Enumeration in einer ComboBox darstellen &#8211; WPF Quicky">Enumeration in einer ComboBox darstellen &#8211; WPF Quicky</a></li><li>17. Januar 2011 -- <a href="http://www.biggle.de/blog/feedflare-fuer-dotnet-kicks-de" title="FeedFlare für dotnet-kicks.de">FeedFlare für dotnet-kicks.de</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.biggle.de/blog/connectionstring-ermitteln-the-simplest-way/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Stored Procedure mit skalaren Rückgabewert im Entity Framework</title>
		<link>http://www.biggle.de/blog/stored-procedure-mit-scalaren-ruckgabewert-im-entity-framework</link>
		<comments>http://www.biggle.de/blog/stored-procedure-mit-scalaren-ruckgabewert-im-entity-framework#comments</comments>
		<pubDate>Wed, 23 Jun 2010 13:35:29 +0000</pubDate>
		<dc:creator>Mario Priebe</dc:creator>
				<category><![CDATA[CSharp]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[EntityFramework]]></category>

		<guid isPermaLink="false">http://www.biggle.de/blog/?p=4895</guid>
		<description><![CDATA[Will man Stored Procedures über das Entity Framework aufrufen, kann man das &#8211; wenn man denn ein EntitySet erwartet &#8211; recht einfach. Erwartet man aber eine skalare Variable (Int32, String, Guid&#8230;) weiter als Response, gibt es leider ein bekanntes Problem, dass dafür kein Code generiert wird. Um dennoch eine solche Procedure verwenden zu können, müssen einige [...]]]></description>
			<content:encoded><![CDATA[<p>Will man Stored Procedures über das Entity Framework aufrufen, kann man das &#8211; wenn man denn ein EntitySet erwartet &#8211; recht einfach. Erwartet man aber eine <a href="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2RlLndpa2lwZWRpYS5vcmcvd2lraS9Ta2FsYXJlX1ZhcmlhYmxl">skalare</a> Variable (Int32, String, Guid&#8230;) weiter als Response, gibt es leider ein <a href="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5nb29nbGUuZGUvc2VhcmNoP3E9ZW50aXR5K2ZyYW1ld29yaytzY2FsYXJlK3N0b3JlZCtwcm9jZWR1cmU=">bekanntes</a> Problem, dass dafür kein Code generiert wird.</p>
<p>Um dennoch eine solche Procedure verwenden zu können, müssen einige Einträge in dem Model von Hand getätigt und im Code muss eine eigene EntityConnection implementiert werden, die für den StoredProcedure-Aufruf eine temporäre Verbindung aufbaut. Um das zu verdeutlichen, hier meine Herangehensweise in einem Testprojekt.</p>
<p>In der Datenbank erstelle ich mir vorerst eine Stored Procedure namens GetPersonenId. Diese Procedure erwartet zwei Parameter, zum einen eine Id, und zum anderen einen boolschen Wert. Was genau in der SP passieren soll, ist für dieses Beispiel nicht relevant.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">USE</span> <span style="color: #009900;">&#91;</span>TestDB2<span style="color: #009900;">&#93;</span>
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE <span style="color: #009900;">&#91;</span>dbo<span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #009900;">&#91;</span>GetPersonenId<span style="color: #009900;">&#93;</span>
	<span style="color: #339933;">@</span>Root uniqueidentifier <span style="color: #339933;">,</span>
	<span style="color: #339933;">@</span>Rekursiv bit
<span style="color: #b1b100;">AS</span>
BEGIN
	SET NOCOUNT ON<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">If</span> <span style="color: #339933;">@</span>Rekursiv <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span>
	BEGIN
		select PersonenId
		from Personen
		where ChildId <span style="color: #339933;">=</span> <span style="color: #339933;">@</span>Root
	<span style="color: #990000;">End</span>
&nbsp;
	<span style="color: #b1b100;">Else</span>
	Begin
		<span style="color: #339933;">--</span> rekursive abfrage<span style="color: #339933;">...</span>
	<span style="color: #990000;">End</span>
<span style="color: #990000;">END</span></pre></td></tr></table></div>

<p>Nun füge ich meinem Projekt ein ADO.NET Entity Data Model hinzu und wähle aus meine Datenbankverbindung meine Datenbank aus.</p>
<p>Im kommenden Dialog wähle ich hier unter den &#8220;Gespeicherten Prozeduren&#8221; meine SP aus.</p>
<p><a href="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5iaWdnbGUuZGUvYmxvZy93cC1jb250ZW50L3VwbG9hZHMvMjAxMC8wNi9TUG1pdEVGMS5wbmc="><img title="SPmitEF1" src="http://www.biggle.de/blog/wp-content/uploads/2010/06/SPmitEF1.png" alt="" width="500" /></a></p>
<p>Das nun erstellte Model schliesse ich und öffne das auch gleich wieder mit den integrierten XML-Editor, dazu ein Rechtsklick auf das Model im Projektmappen-Explorer und auf &#8220;Öffnen mit&#8230;&#8221; Hier wähle ich dann den XML Editor zum öffnen des Modells.</p>
<p><a href="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5iaWdnbGUuZGUvYmxvZy93cC1jb250ZW50L3VwbG9hZHMvMjAxMC8wNi9TUG1pdEVGMi5wbmc="><img title="SPmitEF2" src="http://www.biggle.de/blog/wp-content/uploads/2010/06/SPmitEF2.png" alt="" width="500" /></a></p>
<p>Hier findet man den generierten Code kommentiert mit den jeweiligen Bereichen (SSDL, CSDL, C-S mapping). Im Knoten edmx:StorageModels (SSDL content)  sollte bereits, eine vom EF definierte Funktion existieren, die den Namen der Procedure trägt.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>Function Name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;GetPersonenId&quot;</span> <span style="color: #990000;">Aggregate</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;false&quot;</span> BuiltIn<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;false&quot;</span> NiladicFunction<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;false&quot;</span> IsComposable<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;false&quot;</span> ParameterTypeSemantics<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;AllowImplicitConversion&quot;</span> Schema<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;dbo&quot;</span><span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>Parameter Name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Root&quot;</span> Type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;uniqueidentifier&quot;</span> Mode<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;In&quot;</span> <span style="color: #339933;">/&gt;</span>
  <span style="color: #339933;">&lt;</span>Parameter Name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Rekursiv&quot;</span> Type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;bit&quot;</span> Mode<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;In&quot;</span> <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;/</span>Function<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>Die kann so belassen werden. Im Knoten edmx:ConceptualModels (CSDL content) fügen wir ein FunktionImport Knoten hinzu, der den Rückgabetypen und die Parameter wie diese in der StoredProcedure definiert wurden. Wenn der Knoten EntityContainer kein schliessendes Tag </EntityContainer> hat sondern /> endet, muss dieser so geändert werden.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>FunctionImport Name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;GetPersonenId&quot;</span> ReturnType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Collection(Guid)&quot;</span><span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>Parameter Name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Root&quot;</span> Type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Guid&quot;</span> Mode<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;In&quot;</span> <span style="color: #339933;">/&gt;</span>
  <span style="color: #339933;">&lt;</span>Parameter Name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Rekursiv&quot;</span> Type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Boolean&quot;</span> Mode<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;In&quot;</span> <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;/</span>FunctionImport<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>Im Knoten edmx:Mappings (C-S mapping content) ergänzen wir im Knoten EntityContainerMapping den Knoten FunctionImportMapping. Der kommende FunctionName im Code  ist der im Schema definierte Namespace plus der Name von der SP. Auch hier wichtig, wenn der Knoten EntityContainerMapping kein schliessendes Tag </EntityContainerMapping> hat sondern /> endet, muss dieser so geändert werden.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>FunctionImportMapping FunctionImportName<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;GetPersonenId&quot;</span> FunctionName<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;PersonenModel.Store.GetPersonenId&quot;</span> <span style="color: #339933;">/&gt;</span></pre></td></tr></table></div>

<p>Das edmx-File kann nun gespeichert und geschlossen werden und wir wechseln in die Klasse wo wir die Methode bauen möchten, die die Prozedur  aufruft. Jetzt verweisen wir noch auf System.Configuration um den ConfigurationManager für die Übergabe des ConnectionStrings aus der App.Config. Der Connectionstring kann aber auch direkt in die Variable connection geschrieben werden&#8230;</p>
<p>Hier nun der Code, in den Kommentare werden die einzelnen Zeilen kommentiert.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> static IEnumerable<span style="color: #339933;">&lt;</span>Guid<span style="color: #339933;">&gt;</span> ReadPersonenIdStruktur<span style="color: #009900;">&#40;</span>Guid root<span style="color: #339933;">,</span> bool recursive<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">//Liste instanziieren</span>
    <span style="color: #000000; font-weight: bold;">var</span> personen <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> List<span style="color: #339933;">&lt;</span>Guid<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">//connectionstrring aus der app.config holen</span>
    string connection <span style="color: #339933;">=</span> ConfigurationManager<span style="color: #339933;">.</span>ConnectionStrings<span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;PersonenEntities&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span>ConnectionString<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">//context verwenden</span>
    using <span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> conn <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> EntityConnection<span style="color: #009900;">&#40;</span>connection<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        try
        <span style="color: #009900;">&#123;</span>
            <span style="color: #666666; font-style: italic;">//connection oeffnen</span>
            conn<span style="color: #339933;">.</span>Open<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #666666; font-style: italic;">//EntityCommand instanzieren</span>
            EntityCommand cmd <span style="color: #339933;">=</span> conn<span style="color: #339933;">.</span>CreateCommand<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #666666; font-style: italic;">/* der comandtext setzt sich aus den entities-namen der
             * bei der Erstellung des Models festgelegt wurde
             * plus den Namen der Stored Procedur                     *
             */</span>
            cmd<span style="color: #339933;">.</span>CommandText <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;PersonenEntities.GetPersonenId&quot;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #666666; font-style: italic;">//commandtype festlegen</span>
            cmd<span style="color: #339933;">.</span>CommandType <span style="color: #339933;">=</span> CommandType<span style="color: #339933;">.</span>StoredProcedure<span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #666666; font-style: italic;">//die parameter die erwartet werden von der sp dem Kommando hinzufuegen</span>
            cmd<span style="color: #339933;">.</span>Parameters<span style="color: #339933;">.</span>AddWithValue<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Root&quot;</span><span style="color: #339933;">,</span> root<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            cmd<span style="color: #339933;">.</span>Parameters<span style="color: #339933;">.</span>AddWithValue<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Rekursiv&quot;</span><span style="color: #339933;">,</span> recursive<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #666666; font-style: italic;">//ausfuehren</span>
            <span style="color: #000000; font-weight: bold;">var</span> result <span style="color: #339933;">=</span> cmd<span style="color: #339933;">.</span>ExecuteReader<span style="color: #009900;">&#40;</span>CommandBehavior<span style="color: #339933;">.</span>SequentialAccess<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #666666; font-style: italic;">//ergebnisse in die liste schreiben</span>
            <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span>result<span style="color: #339933;">.</span>Read<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#123;</span>
                personen<span style="color: #339933;">.</span>Add<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>Guid<span style="color: #009900;">&#41;</span>result<span style="color: #339933;">.</span>GetValue<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
        catch <span style="color: #009900;">&#40;</span>Exception ex<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #666666; font-style: italic;">//Fehlerbehandlung</span>
        <span style="color: #009900;">&#125;</span>
        finally
        <span style="color: #009900;">&#123;</span>
            <span style="color: #666666; font-style: italic;">//connection schliessen und wegschmeissen</span>
            conn<span style="color: #339933;">.</span>Close<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            conn<span style="color: #339933;">.</span>Dispose<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">return</span> personen<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Wenn noch Fragen offen sind, versuche ich zu helfen. Ansonsten wie immer,</p>
<p>viel Spass beim entwickeln : )</p>
<p><br class="spacer_" /></p>
<hr /><p style="float:right; font-size:0.9em;">Dieser Beitrag stammt von <a href="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5iaWdnbGUuZGU=">Mario Priebe</a>.</p> <img src="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=4895" width="1" height="1" style="display: none;" /><h2  class="related_post_title">Ähnliche Beiträge</h2><ul class="related_post"><li>15. September 2010 -- <a href="http://www.biggle.de/blog/entity-framework-model-vorgenerieren-ef-view-net-3-5-4-0" title="Das Entity Framework Model vorgenerieren .NET 3.5 und 4.0">Das Entity Framework Model vorgenerieren .NET 3.5 und 4.0</a></li><li>1. August 2010 -- <a href="http://www.biggle.de/blog/connectionstring-ermitteln-the-simplest-way" title="Connectionstring ermitteln &#8211; The simplest way">Connectionstring ermitteln &#8211; The simplest way</a></li><li>18. Mai 2010 -- <a href="http://www.biggle.de/blog/verwenden-des-reportingservice-ssrs-csharp" title="Der ReportingService (SSRS) unter C#">Der ReportingService (SSRS) unter C#</a></li><li>11. Mai 2010 -- <a href="http://www.biggle.de/blog/mehrfache-sql-statements-absetzen-c-quicky" title="Mehrfache SQL Statements absetzen | C# Quicky">Mehrfache SQL Statements absetzen | C# Quicky</a></li><li>25. Januar 2010 -- <a href="http://www.biggle.de/blog/entity-framework-model-updaten" title="Entity Framework Model updaten &#8230;">Entity Framework Model updaten &#8230;</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.biggle.de/blog/stored-procedure-mit-scalaren-ruckgabewert-im-entity-framework/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Der ReportingService (SSRS) unter C#</title>
		<link>http://www.biggle.de/blog/verwenden-des-reportingservice-ssrs-csharp</link>
		<comments>http://www.biggle.de/blog/verwenden-des-reportingservice-ssrs-csharp#comments</comments>
		<pubDate>Tue, 18 May 2010 14:31:37 +0000</pubDate>
		<dc:creator>Mario Priebe</dc:creator>
				<category><![CDATA[CSharp]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.biggle.de/blog/?p=4620</guid>
		<description><![CDATA[Das eine oder andere HowTo um den SQL Server ReportingService anzusprechen funktionierten bei mir immer nur zur Hälfte. Wem es genau so geht, hier eine kleine Anleitung, wie man den ReportingService unter VS2008 via WSDL konsumiert. Zieldefinition: Über eine C# Applikation wird es ermöglich, ein  Bericht über die SQL Server Reporting WSDL Schnittstelle  als PDF [...]]]></description>
			<content:encoded><![CDATA[<p>Das eine oder andere HowTo um den SQL Server ReportingService anzusprechen funktionierten bei mir immer nur zur Hälfte. Wem es genau so geht, hier eine kleine Anleitung, wie man den ReportingService unter VS2008 via WSDL konsumiert.</p>
<p>Zieldefinition: Über eine C# Applikation wird es ermöglich, ein  Bericht über die SQL Server Reporting WSDL Schnittstelle  als PDF zu rendern und zu speichern. Der Bericht muss dazu auf dem ReportServer vorhanden sein. Möchte man einen Bericht erstellen, kann er z.B.  den ReportBuilder 3.0 dazu verwenden.</p>
<p>Okay lets go.</p>
<p>Man fügt dem Projekt zu Beginn einen Dienstverweis hinzu, folgende URL (Server anpassen : ) zum ReportService  wird dazu verwendet.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//&lt;SERVER&gt;/reportserver/reportservice2005.asmx?wsdl</span></pre></td></tr></table></div>

<p>Der Securityknoten in der automatisch angelegten app.conf wird durch folgende Einträge angepasst</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>security mode<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;TransportCredentialOnly&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>transport clientCredentialType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Ntlm&quot;</span> proxyCredentialType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Windows&quot;</span>
        realm<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;/</span>transport<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>security<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>Die Using Direktive für den Client findet man in der eben angelegten ServiceReference, in meinem Fall lautet diese</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">using SQLReportingServiceTest<span style="color: #339933;">.</span>ReportingService<span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Für die Render Methode benötigen wir unter anderen noch einige Variablen und den entsprechenden Clientaufruf.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//Das Format, in dem der Bericht gerendert werden soll. Dieses Argument ist einer Renderingerweiterung zugeordnet. Zu den unterstützten Formaten gehören Microsoft Office Excel, PDF und Image.</span>
string format <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;PDF&quot;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//[out] Die beim Rendern des Berichtsinhalts verwendete Codierung.</span>
string encoding<span style="color: #339933;">;</span>
 <span style="color: #666666; font-style: italic;">//[out] Der MIME-Typ des gerenderten Berichts.</span>
string mimeType<span style="color: #339933;">;</span>
 <span style="color: #666666; font-style: italic;">//[out] Die für die Ausgabedatei verwendete Dateinamenerweiterung.</span>
string extension<span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// [out] Ein Array von Warning-Objekten zur Beschreibung der Warnungen, die während der Berichtsverarbeitung ausgegeben wurden.</span>
Microsoft<span style="color: #339933;">.</span>Reporting<span style="color: #339933;">.</span>WinForms<span style="color: #339933;">.</span>Warning<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> warnings <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span> string<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> streamIDs <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span>
&nbsp;
using <span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> rs <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ReportingService2005SoapClient<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">//Festlegen der zulässigen Identitätswechselebene (Server/Client)</span>
    rs<span style="color: #339933;">.</span>ClientCredentials<span style="color: #339933;">.</span>Windows<span style="color: #339933;">.</span>AllowedImpersonationLevel <span style="color: #339933;">=</span> <span style="color: #990000;">System</span><span style="color: #339933;">.</span>Security<span style="color: #339933;">.</span>Principal<span style="color: #339933;">.</span>TokenImpersonationLevel<span style="color: #339933;">.</span>Impersonation<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">//Instanz des ReportViewer-Steuerelements</span>
    <span style="color: #000000; font-weight: bold;">var</span> rv <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ReportViewer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">//Festlegen des Verarbeitungsmodus des ReportViewer-Steuerelements.</span>
    rv<span style="color: #339933;">.</span>ProcessingMode <span style="color: #339933;">=</span> ProcessingMode<span style="color: #339933;">.</span>Remote<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">//Berichtsserver festlegen</span>
    rv<span style="color: #339933;">.</span>ServerReport<span style="color: #339933;">.</span>ReportServerUrl <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Uri<span style="color: #009900;">&#40;</span><span style="color: #339933;">@</span><span style="color: #0000ff;">&quot;http://&lt;SERVER&gt;/reportserver&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">//Festlegen des Pfades zum Bericht</span>
    rv<span style="color: #339933;">.</span>ServerReport<span style="color: #339933;">.</span>ReportPath <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><span style="color: #0000ff;">&quot;/MeinBericht&quot;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #666666; font-style: italic;">//Verarbeitet den Bericht und rendert ihn im angegebenen Format und speichert diesen in ein byteArray</span>
    byte<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> bytes <span style="color: #339933;">=</span> rv<span style="color: #339933;">.</span>ServerReport<span style="color: #339933;">.</span>Render<span style="color: #009900;">&#40;</span>format<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">,</span> out mimeType<span style="color: #339933;">,</span> out encoding<span style="color: #339933;">,</span> out extension<span style="color: #339933;">,</span> out streamIDs<span style="color: #339933;">,</span> out warnings<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">//Schreibt das Resultat in ein pdf</span>
    FileStream fs <span style="color: #339933;">=</span> <span style="color: #990000;">File</span><span style="color: #339933;">.</span>Create<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;result.pdf&quot;</span><span style="color: #339933;">,</span> bytes<span style="color: #339933;">.</span>Length<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    fs<span style="color: #339933;">.</span>Write<span style="color: #009900;">&#40;</span>bytes<span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span>bytes<span style="color: #339933;">.</span>Length<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    fs<span style="color: #339933;">.</span>Close<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Nach Ausführen dieses Codes, steht im bin Ordner nun eine result.pdf zur Verfügung.</p>
<p><br class="spacer_" /></p>
<p>Weiterführende Links:</p>
<ul>
<li><a href="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL21zZG4ubWljcm9zb2Z0LmNvbS9lbi11cy9saWJyYXJ5L21pY3Jvc29mdC53c3N1eC5yZXBvcnRpbmdzZXJ2aWNlc3dlYnNlcnZpY2UucnNleGVjdXRpb25zZXJ2aWNlMjAwNS5yZXBvcnRleGVjdXRpb25zZXJ2aWNlLnJlbmRlci5hc3B4">ReportExecutionService.Render Method</a></li>
<li><a href="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3N0YWNrb3ZlcmZsb3cuY29tL3NlYXJjaD9xPVJlcG9ydGluZ1NlcnZpY2UyMDA1U29hcENsaWVudA==">StackOverflow</a></li>
<li><a href="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL21zZG4ubWljcm9zb2Z0LmNvbS9lbi11cy9saWJyYXJ5L21zMTcwMjM5LmFzcHg=">Create Code to generate Report Definition File</a></li>
<li><a href="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2VuLmNzaGFycC1vbmxpbmUubmV0L1JlcG9ydGluZ19TZXJ2aWNlc19BcmNoaXRlY3R1cmU=">Architektur</a></li>
<li><a href="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5taWNyb3NvZnQuY29tL2Rvd25sb2Fkcy9kZXRhaWxzLmFzcHg/RmFtaWx5SUQ9ZDMxNzNhODctN2MwZC00MGNjLWE0MDgtM2QxYTQzYWU0ZTMzJmFtcDtkaXNwbGF5bGFuZz1lbg==">MS SQL SERVER 2008 R2 ReportBuilder 3.0 (Tabellen/Matrix/Diagramme)</a></li>
</ul>
<p><br class="spacer_" /></p>
<p>Viel Spass beim entwickeln : )</p>
<hr /><p style="float:right; font-size:0.9em;">Dieser Beitrag stammt von <a href="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5iaWdnbGUuZGU=">Mario Priebe</a>.</p> <img src="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=4620" width="1" height="1" style="display: none;" /><h2  class="related_post_title">Ähnliche Beiträge</h2><ul class="related_post"><li>1. August 2010 -- <a href="http://www.biggle.de/blog/connectionstring-ermitteln-the-simplest-way" title="Connectionstring ermitteln &#8211; The simplest way">Connectionstring ermitteln &#8211; The simplest way</a></li><li>23. Juni 2010 -- <a href="http://www.biggle.de/blog/stored-procedure-mit-scalaren-ruckgabewert-im-entity-framework" title="Stored Procedure mit skalaren Rückgabewert im Entity Framework">Stored Procedure mit skalaren Rückgabewert im Entity Framework</a></li><li>11. Mai 2010 -- <a href="http://www.biggle.de/blog/mehrfache-sql-statements-absetzen-c-quicky" title="Mehrfache SQL Statements absetzen | C# Quicky">Mehrfache SQL Statements absetzen | C# Quicky</a></li><li>19. Dezember 2009 -- <a href="http://www.biggle.de/blog/verteilte-datenbankabfragen" title="Verteilte Datenbankabfragen">Verteilte Datenbankabfragen</a></li><li>19. Dezember 2009 -- <a href="http://www.biggle.de/blog/nutzliche-mathematische-sql-funktionen" title="Nützliche mathematische SQL-Funktionen">Nützliche mathematische SQL-Funktionen</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.biggle.de/blog/verwenden-des-reportingservice-ssrs-csharp/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mehrfache SQL Statements absetzen &#124; C# Quicky</title>
		<link>http://www.biggle.de/blog/mehrfache-sql-statements-absetzen-c-quicky</link>
		<comments>http://www.biggle.de/blog/mehrfache-sql-statements-absetzen-c-quicky#comments</comments>
		<pubDate>Tue, 11 May 2010 14:04:55 +0000</pubDate>
		<dc:creator>Mario Priebe</dc:creator>
				<category><![CDATA[CSharp]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Quicky]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.biggle.de/blog/?p=4597</guid>
		<description><![CDATA[Will man mehrere SQL Statements abschicken, wirft man ein Auge auf &#8220;Transaction&#8221;. Um über ein SQL Command solche Transactions zu starten, kann man folgenden Codeansatz dazu verwenden 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 [...]]]></description>
			<content:encoded><![CDATA[<p>Will man mehrere SQL Statements abschicken, wirft man ein Auge auf &#8220;Transaction&#8221;. Um über ein SQL Command solche Transactions zu starten, kann man folgenden Codeansatz dazu verwenden</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">Guid _testOEguid <span style="color: #339933;">=</span> Guid<span style="color: #339933;">.</span>NewGuid<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> createDummyAgentur <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><span style="color: #0000ff;">&quot;
INSERT INTO [dbo].[TABLE]([COLUMN], [row1], [row2])
SELECT N'{0}', 36485, 1
&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> createDummyOE <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><span style="color: #0000ff;">&quot;
INSERT INTO [dbo].[TABLE]([COLUMN], [row1], [row2])
SELECT N'{0}', N'Bank AG', N'Muster'
&quot;</span><span style="color: #339933;">;</span>
&nbsp;
using <span style="color: #009900;">&#40;</span>SqlConnection con <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> SqlConnection<span style="color: #009900;">&#40;</span>ConfigurationManager<span style="color: #339933;">.</span>ConnectionStrings<span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;TestPersonEntities&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span>ConnectionString<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    con<span style="color: #339933;">.</span>Open<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    SqlTransaction transaction <span style="color: #339933;">=</span> con<span style="color: #339933;">.</span>BeginTransaction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    try
    <span style="color: #009900;">&#123;</span>
        SqlCommand command <span style="color: #339933;">=</span> con<span style="color: #339933;">.</span>CreateCommand<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        command<span style="color: #339933;">.</span>CommandType <span style="color: #339933;">=</span> CommandType<span style="color: #339933;">.</span>Text<span style="color: #339933;">;</span>
        command<span style="color: #339933;">.</span>Transaction <span style="color: #339933;">=</span> transaction<span style="color: #339933;">;</span>
&nbsp;
        command<span style="color: #339933;">.</span>CommandText <span style="color: #339933;">=</span> String<span style="color: #339933;">.</span>Format<span style="color: #009900;">&#40;</span>createDummyOE<span style="color: #339933;">,</span> _testOEguid<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        command<span style="color: #339933;">.</span>ExecuteNonQuery<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        command<span style="color: #339933;">.</span>CommandText <span style="color: #339933;">=</span> String<span style="color: #339933;">.</span>Format<span style="color: #009900;">&#40;</span>createDummyAgentur<span style="color: #339933;">,</span> _testOEguid<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        command<span style="color: #339933;">.</span>ExecuteNonQuery<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        transaction<span style="color: #339933;">.</span>Commit<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    catch <span style="color: #009900;">&#40;</span>Exception<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        transaction<span style="color: #339933;">.</span>Rollback<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    finally
    <span style="color: #009900;">&#123;</span>
        con<span style="color: #339933;">.</span>Close<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Mit dieser Methodik kann man beliebig viele Statements abschicken, einfach oder ?!</p>
<p>Viel Spass beim entwickeln : )</p>
<hr /><p style="float:right; font-size:0.9em;">Dieser Beitrag stammt von <a href="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5iaWdnbGUuZGU=">Mario Priebe</a>.</p> <img src="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=4597" width="1" height="1" style="display: none;" /><h2  class="related_post_title">Ähnliche Beiträge</h2><ul class="related_post"><li>4. November 2011 -- <a href="http://www.biggle.de/blog/wie-verhindere-ich-beim-klick-eines-hyperlinkbuttons-in-silverlight-die-umrandung-quicky" title="Wie verhindere ich beim Klick eines HyperlinkButtons in Silverlight die Umrandung &#8211; Quicky">Wie verhindere ich beim Klick eines HyperlinkButtons in Silverlight die Umrandung &#8211; Quicky</a></li><li>31. März 2011 -- <a href="http://www.biggle.de/blog/wie-ermittle-ich-eine-telefonnummer-aus-dem-telefonbuch-%e2%80%93-wp7-quicky" title="Wie ermittle ich eine Telefonnummer aus dem Telefonbuch? – WP7 Quicky">Wie ermittle ich eine Telefonnummer aus dem Telefonbuch? – WP7 Quicky</a></li><li>14. Februar 2011 -- <a href="http://www.biggle.de/blog/texttrimming-xaml-quicky" title="TextTrimming &#8211;  XAML Quicky">TextTrimming &#8211;  XAML Quicky</a></li><li>14. Februar 2011 -- <a href="http://www.biggle.de/blog/doppelklick-im-datagrid-abfangen-wpf-quicky" title="Doppelklick im DataGrid abfangen &#8211; WPF Quicky">Doppelklick im DataGrid abfangen &#8211; WPF Quicky</a></li><li>27. November 2010 -- <a href="http://www.biggle.de/blog/windows-phone-7-trialmode-testversion-wp7-quicky" title="Windows Phone 7 Trialmode – WP7 Quicky">Windows Phone 7 Trialmode – WP7 Quicky</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.biggle.de/blog/mehrfache-sql-statements-absetzen-c-quicky/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Verteilte Datenbankabfragen</title>
		<link>http://www.biggle.de/blog/verteilte-datenbankabfragen</link>
		<comments>http://www.biggle.de/blog/verteilte-datenbankabfragen#comments</comments>
		<pubDate>Sat, 19 Dec 2009 13:24:42 +0000</pubDate>
		<dc:creator>Mario Priebe</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Tipps]]></category>

		<guid isPermaLink="false">http://www.biggle.de/blog/?p=3418</guid>
		<description><![CDATA[Wenn man ein Ergebniss von mehreren Tabellen aus verschiedenen Datenbanken selektieren möchte, kann man das über ein UNION bewerkstelligen. Die Anzahl der zu selektierenden Spalten muss immer gleich sein. Man kann auch verschiedene Spalten abfragen, diese müssen aber immmer vom selben Datentyp sein. Gegebenfalls muss man diese dann in den entsprechenden Typen casten. Example SELECT [...]]]></description>
			<content:encoded><![CDATA[<p>Wenn man ein Ergebniss von mehreren Tabellen aus verschiedenen Datenbanken selektieren möchte, kann man das über ein UNION bewerkstelligen.</p>
<p>Die Anzahl der zu selektierenden Spalten muss immer gleich sein. Man kann auch verschiedene Spalten abfragen, diese müssen aber immmer vom selben Datentyp sein. Gegebenfalls muss man diese dann in den entsprechenden Typen casten.</p>
<p>Example</p>
<p><br class="spacer_" /></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">SELECT lastname<span style="color: #339933;">,</span> firstname FROM db1<span style="color: #339933;">.</span>contactTable
UNION
SELECT lastname<span style="color: #339933;">,</span> firstname FROM db2<span style="color: #339933;">.</span>otherTable</pre></div></div>

<p><br class="spacer_" /></p>
<hr /><p style="float:right; font-size:0.9em;">Dieser Beitrag stammt von <a href="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5iaWdnbGUuZGU=">Mario Priebe</a>.</p> <img src="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=3418" width="1" height="1" style="display: none;" /><h2  class="related_post_title">Ähnliche Beiträge</h2><ul class="related_post"><li>1. August 2010 -- <a href="http://www.biggle.de/blog/connectionstring-ermitteln-the-simplest-way" title="Connectionstring ermitteln &#8211; The simplest way">Connectionstring ermitteln &#8211; The simplest way</a></li><li>31. Juli 2011 -- <a href="http://www.biggle.de/blog/gottmodus-in-windows-7-aktivieren" title="Gottmodus in Windows 7 aktivieren">Gottmodus in Windows 7 aktivieren</a></li><li>4. Juli 2011 -- <a href="http://www.biggle.de/blog/neuer-ordner-im-projekt-per-hotkey" title="Neuer Ordner im Projekt per Hotkey">Neuer Ordner im Projekt per Hotkey</a></li><li>25. Juni 2011 -- <a href="http://www.biggle.de/blog/enumeration-in-einer-combobox-darstellen-wpf-quicky" title="Enumeration in einer ComboBox darstellen &#8211; WPF Quicky">Enumeration in einer ComboBox darstellen &#8211; WPF Quicky</a></li><li>17. Januar 2011 -- <a href="http://www.biggle.de/blog/feedflare-fuer-dotnet-kicks-de" title="FeedFlare für dotnet-kicks.de">FeedFlare für dotnet-kicks.de</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.biggle.de/blog/verteilte-datenbankabfragen/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

