<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.dotnetzone.gr:443/cs/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>ADO.NET</title><link>https://www.dotnetzone.gr:443/cs/forums/78/ShowForum.aspx</link><description>Θέματα σχετικά με την προσπέλαση δεδομένων μέσω του ADO.NET και του System.Data namespace</description><dc:language>el</dc:language><generator>CommunityServer 2.1 SP3 (Build: 20423.1)</generator><item><title>Απ: Mange connections with Enterprise Library</title><link>https://www.dotnetzone.gr:443/cs/forums/thread/61174.aspx</link><pubDate>Tue, 30 Nov 2010 05:58:15 GMT</pubDate><guid isPermaLink="false">2622095e-976c-431a-859e-16783ec7ecd7:61174</guid><dc:creator>StrouMfios</dc:creator><slash:comments>0</slash:comments><comments>https://www.dotnetzone.gr:443/cs/forums/thread/61174.aspx</comments><wfw:commentRss>https://www.dotnetzone.gr:443/cs/forums/commentrss.aspx?SectionID=78&amp;PostID=61174</wfw:commentRss><description>Τώρα έχω αναθεωρήσει το γεγονός οτι μπορεί να είναι bug.&lt;div&gt;Το δικό σου post είναι σωστό και σ'ευχαριστώ για την βοήθεια αλλά εφαρμόζεται μόνο σε περιπτώσεις που χρησιμοποιούμε .net controls (όπως λέει και το άρθρο).&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Εν το μεταξύ μου έκανε φοβερή εντύπωση το γεγονός οτι για ExecuteScalar, ExecuteNonQuery, ExecuteXMLReader πρέπει και πάλι να ελέγχω αν το connection ειναι open ωστε να το κλείσω manually.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Το περίμενα πιο intelligent.&lt;/div&gt;</description></item><item><title>Απ: Mange connections with Enterprise Library</title><link>https://www.dotnetzone.gr:443/cs/forums/thread/61154.aspx</link><pubDate>Tue, 30 Nov 2010 03:58:55 GMT</pubDate><guid isPermaLink="false">2622095e-976c-431a-859e-16783ec7ecd7:61154</guid><dc:creator>nikolaosk</dc:creator><slash:comments>0</slash:comments><comments>https://www.dotnetzone.gr:443/cs/forums/thread/61154.aspx</comments><wfw:commentRss>https://www.dotnetzone.gr:443/cs/forums/commentrss.aspx?SectionID=78&amp;PostID=61154</wfw:commentRss><description>Ναι ο σωτήρης έδωσε το σωστό Link.&lt;br&gt;&lt;br&gt;αν προσέξεις κάπου στον κώδικα έχει το εξής&lt;br&gt;&lt;br&gt;&lt;table width="100%" border="0" cellpadding="0" cellspacing="0"&gt;&lt;tr style="vertical-align:top;line-height:normal;"&gt;&lt;td style="width:40px;text-align:right;"&gt;&lt;pre style="font-family:courier new;font-size:11px;color:gray;margin:0px;padding:2px;"&gt;1
2
 &lt;/pre&gt;&lt;/td&gt;&lt;td&gt;&lt;pre style="margin:0px;padding:2px 2px 2px 8px;"&gt;&lt;span style="color:Black;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt; &lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;if&lt;/span&gt; (command.Connection.State == ConnectionState.Open)
            command.Connection.Close();&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br&gt;που είναι ο ίδιος κώδικας που σου έδωσα και εγώ στο δικό μου post σε Vb&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;span style="color:Black;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;&lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;if&lt;/span&gt; connection.State=Connection.Open &lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;then&lt;/span&gt; Connection.Close &lt;/span&gt;&lt;/pre&gt;Οπότε τίποτα δεν είναι bug, απλά πρέπει να είμαστε γνώστες το πως χειρίζεται τα connections το DAAB. &lt;br&gt;&lt;br&gt;&lt;br&gt;</description></item><item><title>Απ: Mange connections with Enterprise Library</title><link>https://www.dotnetzone.gr:443/cs/forums/thread/61130.aspx</link><pubDate>Mon, 29 Nov 2010 17:44:23 GMT</pubDate><guid isPermaLink="false">2622095e-976c-431a-859e-16783ec7ecd7:61130</guid><dc:creator>StrouMfios</dc:creator><slash:comments>0</slash:comments><comments>https://www.dotnetzone.gr:443/cs/forums/thread/61130.aspx</comments><wfw:commentRss>https://www.dotnetzone.gr:443/cs/forums/commentrss.aspx?SectionID=78&amp;PostID=61130</wfw:commentRss><description>Πολυ καλό το άρθρο και αρκετά ξεκάθαρο.&lt;div&gt;Οπότε στην περίπτωση μου, πρέπει να διαχειριστώ μόνος μου το άνοιγμα και το κλείσιμο των connections.&lt;/div&gt;&lt;div&gt;Αφου δεν κάνω bind σε κάποιο .net control, δεν επωφελούμε απο το CommandBehavior.CloseConnection.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Ευχαριστώ&lt;/div&gt;</description></item><item><title>Απ: Mange connections with Enterprise Library</title><link>https://www.dotnetzone.gr:443/cs/forums/thread/61129.aspx</link><pubDate>Mon, 29 Nov 2010 07:11:35 GMT</pubDate><guid isPermaLink="false">2622095e-976c-431a-859e-16783ec7ecd7:61129</guid><dc:creator>cap</dc:creator><slash:comments>0</slash:comments><comments>https://www.dotnetzone.gr:443/cs/forums/thread/61129.aspx</comments><wfw:commentRss>https://www.dotnetzone.gr:443/cs/forums/commentrss.aspx?SectionID=78&amp;PostID=61129</wfw:commentRss><description>Προσοχή με το CommandBehavior.CloseConnection. Διαβασε εδώ:&amp;nbsp;&lt;a href="http://richarddingwall.name/2009/06/10/memory-leak-with-enterprise-library-4-data-block-and-execute-reader/"&gt;http://richarddingwall.name/2009/06/10/memory-leak-with-enterprise-library-4-data-block-and-execute-reader/&lt;/a&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://richarddingwall.name/2009/06/10/memory-leak-with-enterprise-library-4-data-block-and-execute-reader/"&gt;&lt;/a&gt;Αντιγράφω την εξήγηση που παραθέτει ο ίδιος από το MSDN Mag του 2003(!)&lt;br&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;i&gt;…My test application shows that even when you use this [CommandBehavior.CloseConnection] option, if you don’t explicitly close the DataReader (or SqlConnection), the pool overflows. The application then throws an exception when the code requests more connections than the pool will hold.&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;Some developers insist that if you set the CommandBehavior.CloseConnection option, the DataReader and its associated connection close automatically when the DataReader finishes reading the data. Those developers are partially rightbut the option works this way only when you’re using a complex bound control in an ASP.NET Web application. Looping through a DataReader result set to the end of its rowset (that is, when the DataReader’s Read method returns false) isn’t enough to trigger automatic connection closing. However, if you bind to a complex bound control such as the DataGrid, the control closes the DataReader and the connection but only if you’ve set the CommandBehavior.CloseConnection option.&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;If you execute a query by using another Execute method (e.g., ExecuteScalar, ExecuteNonQuery, ExecuteXMLReader), you are responsible for opening the SqlConnection object and, more importantly, closing it when the query finishes. If you miss a close, orphaned connections quickly accumulate.&lt;/i&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description></item><item><title>Απ: Mange connections with Enterprise Library</title><link>https://www.dotnetzone.gr:443/cs/forums/thread/61128.aspx</link><pubDate>Mon, 29 Nov 2010 07:09:58 GMT</pubDate><guid isPermaLink="false">2622095e-976c-431a-859e-16783ec7ecd7:61128</guid><dc:creator>Παναγιώτης Καναβός</dc:creator><slash:comments>0</slash:comments><comments>https://www.dotnetzone.gr:443/cs/forums/thread/61128.aspx</comments><wfw:commentRss>https://www.dotnetzone.gr:443/cs/forums/commentrss.aspx?SectionID=78&amp;PostID=61128</wfw:commentRss><description>&lt;P&gt;Νίκο, μάλλον τα έμπλεξες. Εφόσον χρησιμοποιείς using, τί το θέλεις το καρφωτό Close και το CommandBehavior ???? &lt;/P&gt;</description></item><item><title>Απ: Mange connections with Enterprise Library</title><link>https://www.dotnetzone.gr:443/cs/forums/thread/61126.aspx</link><pubDate>Mon, 29 Nov 2010 07:02:26 GMT</pubDate><guid isPermaLink="false">2622095e-976c-431a-859e-16783ec7ecd7:61126</guid><dc:creator>nikolaosk</dc:creator><slash:comments>0</slash:comments><comments>https://www.dotnetzone.gr:443/cs/forums/thread/61126.aspx</comments><wfw:commentRss>https://www.dotnetzone.gr:443/cs/forums/commentrss.aspx?SectionID=78&amp;PostID=61126</wfw:commentRss><description>Με ADO.net ή enterprise library το connection, όταν καλείς την ExecuteReader() του command object, μένει ανοικτό.&lt;br&gt;&lt;br&gt;είχες τα statements σου μέσα σε "using" blocks? Γενικά τα objects σου(ο κώδικας που φαντάζομαι έχεις γράψει με το datareader) μέσα στα using statements (αν τα είχες) υλοποιούν το IDisposable interface.&lt;br&gt;&lt;br&gt;Επίσης θα μπορούσες να κάνεις το εξής:&lt;br&gt;&lt;b&gt;&lt;br&gt;Dim myreader As SqlDataReader&amp;nbsp; = command.ExecuteReader(CommandBehavior.CloseConnection)&lt;/b&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;και στο τέλος να κάνεις ένα έλεγχο και να κλείνεις πάλι το connection κάπως έτσι.&lt;br&gt;&lt;br&gt;&lt;b&gt;if connection.State=Connection.Open then Connection.Close&lt;/b&gt; &lt;br&gt;&lt;br&gt;Δοκίμασε λοιπόν πάλι να παίξεις με το DataReader object και να αλλάξεις λίγο τον κώδικα σου.&lt;br&gt;</description></item><item><title>Απ: Mange connections with Enterprise Library</title><link>https://www.dotnetzone.gr:443/cs/forums/thread/61121.aspx</link><pubDate>Sun, 28 Nov 2010 21:49:24 GMT</pubDate><guid isPermaLink="false">2622095e-976c-431a-859e-16783ec7ecd7:61121</guid><dc:creator>StrouMfios</dc:creator><slash:comments>0</slash:comments><comments>https://www.dotnetzone.gr:443/cs/forums/thread/61121.aspx</comments><wfw:commentRss>https://www.dotnetzone.gr:443/cs/forums/commentrss.aspx?SectionID=78&amp;PostID=61121</wfw:commentRss><description>Προβληματίστκα αρκετά με το&amp;nbsp;enterprise&amp;nbsp;library γιατί ενώ διαχειρίζεται τα connections αυτόματα και ενώ είμαι ο μοναδικός χρήστης που χρησιμοποιεί την βάση, υπήρχαν πάνω απο 15 connections ανοιχτά.&amp;nbsp;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Σαν επιστροφή πάντα χρησιμοποιώ DataReader για λόγους performance, αλλά είδα τελικά οτι χρησιμοποιώντας DataReader και παρόλο που το κλείνω (το dataReader), το connection έμενε ανοιχτό.&lt;/div&gt;&lt;div&gt;Στις ίδιες μεθόδους αντι για DataReader χρησιμοποίησα DataSet και είδα οτι τελικά το connection όντως κλείνει και ανοίγει αυτόματα και σαφώς γίνεται χρήση του pooling.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Είναι κάποιο bug που έχει το enterprise library?&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Ευχαριστώ&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;</description></item><item><title>Απ: Mange connections with Enterprise Library</title><link>https://www.dotnetzone.gr:443/cs/forums/thread/61117.aspx</link><pubDate>Sun, 28 Nov 2010 07:33:06 GMT</pubDate><guid isPermaLink="false">2622095e-976c-431a-859e-16783ec7ecd7:61117</guid><dc:creator>nikolaosk</dc:creator><slash:comments>0</slash:comments><comments>https://www.dotnetzone.gr:443/cs/forums/thread/61117.aspx</comments><wfw:commentRss>https://www.dotnetzone.gr:443/cs/forums/commentrss.aspx?SectionID=78&amp;PostID=61117</wfw:commentRss><description>&lt;br&gt;Έχεις δίκιο στο ότι το enterpise library διαχειρίζεται τα connections για σένα. Ακολουθεί την πολύ καλή και σοφή διαδικασία του "ανοίγω αργά το connection - κλείνω νωρίς το connection".Αν εσύ γεμίζεις ένα dataset με data, το enterprise library θα διαχειριστεί αυτό το "ανοιγοκλείσιμο". Έχει ένα δικό του config αρχείο που αποθηκεύει τα connection strings. Είναι xml based (e.g web.config,app.config) και υπάρχει ειδικό εργαλείο το &lt;b&gt;Enterprise Library Configuration Tool&lt;/b&gt; το οποίο επιτρέπει την εύκολη επεξεργασία του. &lt;br&gt;</description></item><item><title>Mange connections with Enterprise Library</title><link>https://www.dotnetzone.gr:443/cs/forums/thread/61100.aspx</link><pubDate>Sat, 27 Nov 2010 01:42:36 GMT</pubDate><guid isPermaLink="false">2622095e-976c-431a-859e-16783ec7ecd7:61100</guid><dc:creator>StrouMfios</dc:creator><slash:comments>0</slash:comments><comments>https://www.dotnetzone.gr:443/cs/forums/thread/61100.aspx</comments><wfw:commentRss>https://www.dotnetzone.gr:443/cs/forums/commentrss.aspx?SectionID=78&amp;PostID=61100</wfw:commentRss><description>Καλησπέρα σε όλους,&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;έχω ξεκινήσει ενα project σε c#, sqlServer και για το DAL χρησιμοποιώ enterprise library.&lt;/div&gt;&lt;div&gt;Το πρόβλημα μου είναι οτι δεν ξέρω πως γίνεται η διαχείριση των connections.&lt;/div&gt;&lt;div&gt;Είχα διαβάσει ενα άρθρο το οποίο έλεγε οτι τα connections ανοίγουν και κλείνουν αυτόματα.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Έχω τους ενδοιασμούς μου και θα ήθελα να μάθω αν κάτι τέτοιο αληθεύει.&lt;/div&gt;&lt;div&gt;Στην περίπτωση που δεν αληθεύει ποιός είναι ο καλύτερος τρόπος για την διαχείριση των connections?&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Αυτή είναι μια απο τις μεθόδους που χρησιμοποιώ&lt;/div&gt;&lt;div&gt;&lt;pre&gt;&lt;span style="color:Black;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;&lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;public&lt;/span&gt; DataSet GetHotelAvailability(&lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;string&lt;/span&gt; hotelID, &lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;string&lt;/span&gt; date) {
            var sqlStr &lt;span style="color:Red;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;=&lt;/span&gt; &lt;span style="color:#666666;background-color:#e4e4e4;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;"SELECT something"&lt;/span&gt;;
            DbCommand cmd &lt;span style="color:Red;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;=&lt;/span&gt; db.GetSqlStringCommand(sqlStr);

            db.AddInParameter(cmd, &lt;span style="color:#666666;background-color:#e4e4e4;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;"@HotelID"&lt;/span&gt;, SqlDbType.BigInt, hotelID);
            db.AddInParameter(cmd, &lt;span style="color:#666666;background-color:#e4e4e4;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;"@Date"&lt;/span&gt;, SqlDbType.NVarChar, date);

            &lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;return&lt;/span&gt; db.ExecuteDataSet(cmd);
        }&lt;/span&gt;&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Ευχαριστώ&lt;/div&gt;</description></item></channel></rss>