<?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/73/ShowForum.aspx</link><description>Για όσους κάνουν τα πρώτα τους βήματα στην Microsoft Access ή τον SQL Server, ή γενικότερα στη θεωρία βάσεων δεδομένων.</description><dc:language>el</dc:language><generator>CommunityServer 2.1 SP3 (Build: 20423.1)</generator><item><title>Απ: Generic DB Access</title><link>https://www.dotnetzone.gr:443/cs/forums/thread/60047.aspx</link><pubDate>Fri, 17 Sep 2010 18:22:34 GMT</pubDate><guid isPermaLink="false">2622095e-976c-431a-859e-16783ec7ecd7:60047</guid><dc:creator>zababa</dc:creator><slash:comments>0</slash:comments><comments>https://www.dotnetzone.gr:443/cs/forums/thread/60047.aspx</comments><wfw:commentRss>https://www.dotnetzone.gr:443/cs/forums/commentrss.aspx?SectionID=73&amp;PostID=60047</wfw:commentRss><description>OK, ευχαριστώ για τη σημείωση! Είμαι ακόμα καινούριος, και δεν ξέρω τα κατατόπια! :)&lt;br&gt;</description></item><item><title>Απ: Generic DB Access</title><link>https://www.dotnetzone.gr:443/cs/forums/thread/60046.aspx</link><pubDate>Fri, 17 Sep 2010 18:14:13 GMT</pubDate><guid isPermaLink="false">2622095e-976c-431a-859e-16783ec7ecd7:60046</guid><dc:creator>Μπλουγουράς Γιάννης</dc:creator><slash:comments>0</slash:comments><comments>https://www.dotnetzone.gr:443/cs/forums/thread/60046.aspx</comments><wfw:commentRss>https://www.dotnetzone.gr:443/cs/forums/commentrss.aspx?SectionID=73&amp;PostID=60046</wfw:commentRss><description>&lt;P&gt;Φίλε μου είναι καλή πρακτική εφόσον έχεις λάβει απάντηση που σε&amp;nbsp;ικανοποιει&amp;nbsp;να πατήσεις το κουμπί "σημειώση ως Απαντητής" , έτσι η ερώτηση σου&amp;nbsp;αλλάζει κατάσταση και δεν εκκρεμεί.&lt;/P&gt;</description></item><item><title>Απ: Generic DB Access</title><link>https://www.dotnetzone.gr:443/cs/forums/thread/60045.aspx</link><pubDate>Fri, 17 Sep 2010 17:50:59 GMT</pubDate><guid isPermaLink="false">2622095e-976c-431a-859e-16783ec7ecd7:60045</guid><dc:creator>zababa</dc:creator><slash:comments>0</slash:comments><comments>https://www.dotnetzone.gr:443/cs/forums/thread/60045.aspx</comments><wfw:commentRss>https://www.dotnetzone.gr:443/cs/forums/commentrss.aspx?SectionID=73&amp;PostID=60045</wfw:commentRss><description>Ευχαριστώ πολύ! :)&lt;br&gt;</description></item><item><title>Απ: Generic DB Access</title><link>https://www.dotnetzone.gr:443/cs/forums/thread/60004.aspx</link><pubDate>Wed, 15 Sep 2010 01:12:31 GMT</pubDate><guid isPermaLink="false">2622095e-976c-431a-859e-16783ec7ecd7:60004</guid><dc:creator>George J. Capnias</dc:creator><slash:comments>0</slash:comments><comments>https://www.dotnetzone.gr:443/cs/forums/thread/60004.aspx</comments><wfw:commentRss>https://www.dotnetzone.gr:443/cs/forums/commentrss.aspx?SectionID=73&amp;PostID=60004</wfw:commentRss><description>&lt;P&gt;
&lt;TABLE style="BORDER-BOTTOM:#e5e5e5 1px solid;BORDER-LEFT:#e5e5e5 1px solid;BACKGROUND-COLOR:#f2f2f2;BORDER-TOP:#e5e5e5 1px solid;BORDER-RIGHT:#e5e5e5 1px solid;" border=0 cellSpacing=0 cellPadding=0 width="100%"&gt;

&lt;TR style="LINE-HEIGHT:normal;VERTICAL-ALIGN:top;"&gt;
&lt;TD style="TEXT-ALIGN:right;WIDTH:40px;"&gt;&lt;PRE style="PADDING-BOTTOM:2px;MARGIN:0px;PADDING-LEFT:2px;PADDING-RIGHT:2px;FONT-FAMILY:courier new;COLOR:gray;FONT-SIZE:11px;BORDER-RIGHT:#e7e7e7 1px solid;PADDING-TOP:2px;"&gt;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
 &lt;/PRE&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;PRE style="PADDING-BOTTOM:2px;MARGIN:0px;PADDING-LEFT:8px;PADDING-RIGHT:2px;PADDING-TOP:2px;"&gt;&lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:black;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;&lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;Dim&lt;/SPAN&gt; provider &lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;As&lt;/SPAN&gt; DbProviderFactory &lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:red;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;=&lt;/SPAN&gt; DbProviderFactories.GetFactory(&lt;SPAN style="BACKGROUND-COLOR:#e4e4e4;FONT-FAMILY:Courier New;COLOR:#666666;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;"System.Data.SqlClient"&lt;/SPAN&gt;)
&lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;Dim&lt;/SPAN&gt; results &lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;As&lt;/SPAN&gt; DataTable &lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:red;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;New&lt;/SPAN&gt; DataTable()

Using connection &lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;As&lt;/SPAN&gt; DbConnection &lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:red;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;=&lt;/SPAN&gt; provider.CreateConnection()
    connection.ConnectionString &lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:red;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="BACKGROUND-COLOR:#e4e4e4;FONT-FAMILY:Courier New;COLOR:#666666;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;"Data Source=VM-WIN7VS2K8PRO\SQLEXPRESS;Initial Catalog=AdventureWorksLT;Integrated Security=True"&lt;/SPAN&gt;

    &lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;command&lt;/SPAN&gt; &lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;As&lt;/SPAN&gt; DbCommand &lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:red;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;=&lt;/SPAN&gt; connection.CreateCommand()
    &lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;command&lt;/SPAN&gt;.CommandText &lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:red;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="BACKGROUND-COLOR:#e4e4e4;FONT-FAMILY:Courier New;COLOR:#666666;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;"SELECT * FROM [SalesLT].[Customer] WHERE [CustomerID]=@Id"&lt;/SPAN&gt;
    &lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;command&lt;/SPAN&gt;.CommandType &lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:red;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;=&lt;/SPAN&gt; CommandType.Text

    &lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;Dim&lt;/SPAN&gt; parameter &lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;As&lt;/SPAN&gt; DbParameter &lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:red;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;command&lt;/SPAN&gt;.CreateParameter()
    parameter.DbType &lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:red;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;=&lt;/SPAN&gt; DbType.&lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;String&lt;/SPAN&gt;
    parameter.Direction &lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:red;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;=&lt;/SPAN&gt; ParameterDirection.&lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;Input&lt;/SPAN&gt;
    parameter.ParameterName &lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:red;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="BACKGROUND-COLOR:#e4e4e4;FONT-FAMILY:Courier New;COLOR:#666666;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;"@Id"&lt;/SPAN&gt;
    parameter.Value &lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:red;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;=&lt;/SPAN&gt; 1
    &lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;command&lt;/SPAN&gt;.Parameters.&lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;Add&lt;/SPAN&gt;(parameter)

    connection.Open()
    results.Load(&lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;command&lt;/SPAN&gt;.ExecuteReader(CommandBehavior.CloseConnection))

&lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;End&lt;/SPAN&gt; Using

&lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;For&lt;/SPAN&gt; &lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;Each&lt;/SPAN&gt; row &lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;As&lt;/SPAN&gt; DataRow &lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;In&lt;/SPAN&gt; results.Rows
    Console.WriteLine(&lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;String&lt;/SPAN&gt;.&lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;Format&lt;/SPAN&gt;(&lt;SPAN style="BACKGROUND-COLOR:#e4e4e4;FONT-FAMILY:Courier New;COLOR:#666666;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;"Id: {0}"&lt;/SPAN&gt;, row.Field(Of &lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;Integer&lt;/SPAN&gt;)(0)))
&lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;Next&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;/P&gt;
&lt;P&gt;George J.&lt;BR&gt;&lt;/P&gt;</description></item><item><title>Generic DB Access</title><link>https://www.dotnetzone.gr:443/cs/forums/thread/60002.aspx</link><pubDate>Tue, 14 Sep 2010 23:45:16 GMT</pubDate><guid isPermaLink="false">2622095e-976c-431a-859e-16783ec7ecd7:60002</guid><dc:creator>zababa</dc:creator><slash:comments>0</slash:comments><comments>https://www.dotnetzone.gr:443/cs/forums/thread/60002.aspx</comments><wfw:commentRss>https://www.dotnetzone.gr:443/cs/forums/commentrss.aspx?SectionID=73&amp;PostID=60002</wfw:commentRss><description>Γειά χαρά σε όλους! :)&lt;br&gt;&lt;br&gt;Μόλις έγινα μέλος και είπα να ρωτήσω κάτι που ψάχνω εδώ και λίγο καιρό...&lt;br&gt;Για μια εφαρμογή που αναπτύσσω τώρα χρειάζομαι πρόσβαση σε διάφορες βάσεις δεδομένων (SQLite, MySQL, MS Access...), οπότε πρέπει να εναλλάσσω τα connections ανάλογα με τη βάση. Αντί όμως να το κάνω "παραδοσιακά", παίρνοντας περιπτώσεις, ήθελα να χρησιμοποιήσω το DataFactory, για το οποίο είχα ακούσει κάποτε... Αν ξέρει κανείς πως μπορώ να το χρησιμοποιήσω, θα του ήμουν ευγνώμων για τη βοήθεια! Αν χρειάζεται να το κατεβάσω, αν απλά πρέπει να προσθέσω κάποιο reference... ο,τιδήποτε! :)&lt;br&gt;&lt;br&gt;Α, κάτι που ξέχασα! Δουλεύω σε Visual Studio 2010, και χρησιμοποιώ την VB. &lt;br&gt;&lt;br&gt;Ευχαριστώ! :)&lt;br&gt;</description></item></channel></rss>