<?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>Πρώτα Βήματα - Γλώσσες προγραμματισμού</title><link>https://www.dotnetzone.gr:443/cs/forums/74/ShowForum.aspx</link><description>Τα πρώτα βήματα στις γλώσσες VB6, VB.NET, και C#</description><dc:language>el</dc:language><generator>CommunityServer 2.1 SP3 (Build: 20423.1)</generator><item><title>Απ: Ερώτηση για OleDb Exception μεσα σε try-catch-finally block</title><link>https://www.dotnetzone.gr:443/cs/forums/thread/39775.aspx</link><pubDate>Fri, 01 Feb 2008 23:14:44 GMT</pubDate><guid isPermaLink="false">2622095e-976c-431a-859e-16783ec7ecd7:39775</guid><dc:creator>KelMan</dc:creator><slash:comments>0</slash:comments><comments>https://www.dotnetzone.gr:443/cs/forums/thread/39775.aspx</comments><wfw:commentRss>https://www.dotnetzone.gr:443/cs/forums/commentrss.aspx?SectionID=74&amp;PostID=39775</wfw:commentRss><description>&lt;P&gt;Ρίξε μια ματιά εδώ &lt;A href="http://msdn2.microsoft.com/en-us/library/system.data.oledb.oledbconnection.aspx"&gt;http://msdn2.microsoft.com/en-us/library/system.data.oledb.oledbconnection.aspx&lt;/A&gt;&amp;nbsp;στην ενότητα "Remarks" και στο παράδειγμα που έχει.&lt;/P&gt;
&lt;P&gt;Ως προς το exception, κοίταξε εδώ: &lt;A href="http://msdn2.microsoft.com/en-us/library/system.data.oledb.oledbexception.aspx"&gt;http://msdn2.microsoft.com/en-us/library/system.data.oledb.oledbexception.aspx&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description></item><item><title>Ερώτηση για OleDb Exception μεσα σε try-catch-finally block</title><link>https://www.dotnetzone.gr:443/cs/forums/thread/39773.aspx</link><pubDate>Fri, 01 Feb 2008 22:04:58 GMT</pubDate><guid isPermaLink="false">2622095e-976c-431a-859e-16783ec7ecd7:39773</guid><dc:creator>kallileo</dc:creator><slash:comments>0</slash:comments><comments>https://www.dotnetzone.gr:443/cs/forums/thread/39773.aspx</comments><wfw:commentRss>https://www.dotnetzone.gr:443/cs/forums/commentrss.aspx?SectionID=74&amp;PostID=39773</wfw:commentRss><description>&lt;DIV&gt;Έχω δυο απορίες. &lt;/DIV&gt;
&lt;DIV&gt;Έχοντας στον παρακάτω κομμάτι κώδικα αν ήθελα&amp;nbsp;να κλεινω το OleDbConnection conn οτι&amp;nbsp;και να γίνει στο μπλοκ finally πως θα μπορουσα να το κανω? Θα επρεπε να κανω το&amp;nbsp;&lt;STRONG&gt;conn&lt;/STRONG&gt; public ωστε να ειναι διαθεσιμο και μεσα&amp;nbsp;απο το finally?&lt;/DIV&gt;
&lt;DIV&gt;Και η δεύτερη είναι για το πως θα μπορούσα να κάνω catch το exception που μου&amp;nbsp;πεταει όταν εισάγω μια τιμή στην βάση που ήδη υπάρχει σε αυτην. Ποιο ακριβώς ειναι το όνομά του?&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Ευχαριστώ&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:black;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;try&lt;/SPAN&gt;&lt;BR&gt;{&lt;BR&gt;OleDbConnection conn &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;new&lt;/SPAN&gt; OleDbConnection(&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:#666666;FONT-FAMILY:Courier New;BACKGROUND-COLOR:#e4e4e4;"&gt;@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\Magazi.mdb"&lt;/SPAN&gt;);&lt;BR&gt;conn.Open();&lt;BR&gt;OleDbCommand cmd &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;new&lt;/SPAN&gt; OleDbCommand(&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:#666666;FONT-FAMILY:Courier New;BACKGROUND-COLOR:#e4e4e4;"&gt;"INSERT INTO Suppliers (Name,Address,Additional) VALUES (@Name,@Address,@Additional)"&lt;/SPAN&gt;, conn);&lt;BR&gt;OleDbParameter parName &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;new&lt;/SPAN&gt; OleDbParameter();&lt;BR&gt;parName.ParameterName &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:#666666;FONT-FAMILY:Courier New;BACKGROUND-COLOR:#e4e4e4;"&gt;"@Name"&lt;/SPAN&gt;;&lt;BR&gt;parName.Value &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; textBox1.Text;&lt;BR&gt;OleDbParameter parAddress &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;new&lt;/SPAN&gt; OleDbParameter();&lt;BR&gt;parAddress.ParameterName &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:#666666;FONT-FAMILY:Courier New;BACKGROUND-COLOR:#e4e4e4;"&gt;"@Address"&lt;/SPAN&gt;;&lt;BR&gt;parAddress.Value &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; textBox2.Text;&lt;BR&gt;OleDbParameter parAdditional &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;new&lt;/SPAN&gt; OleDbParameter();&lt;BR&gt;parAdditional.ParameterName &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:#666666;FONT-FAMILY:Courier New;BACKGROUND-COLOR:#e4e4e4;"&gt;"@Additional"&lt;/SPAN&gt;;&lt;BR&gt;parAdditional.Value &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; textBox3.Text;&lt;BR&gt;cmd.Parameters.Add(parName);&lt;BR&gt;cmd.Parameters.Add(parAdditional);&lt;BR&gt;cmd.Parameters.Add(parAddress);&lt;BR&gt;cmd.ExecuteNonQuery();&lt;BR&gt;&lt;BR&gt;}&lt;BR&gt;&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;catch&lt;/SPAN&gt; (System.Exception ex)&lt;BR&gt;{&lt;BR&gt;MessageBox.Show(&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:#666666;FONT-FAMILY:Courier New;BACKGROUND-COLOR:#e4e4e4;"&gt;"Παρουσιάστηκε Σφάλμα"&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;+&lt;/SPAN&gt; ex.ToString());&lt;BR&gt;}&lt;BR&gt;&lt;BR&gt;&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;finally&lt;/SPAN&gt;&lt;BR&gt;{ &lt;BR&gt;&lt;BR&gt;}&lt;/SPAN&gt;&amp;nbsp;&lt;/DIV&gt;</description></item></channel></rss>