<?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>数据库 &#8211; WilliamKyle&#039;s Home</title>
	<atom:link href="https://www.williamkyle.com.cn/archives/tag/%E6%95%B0%E6%8D%AE%E5%BA%93/feed" rel="self" type="application/rss+xml" />
	<link>https://www.williamkyle.com.cn</link>
	<description>不积跬步，无以至千里；不积小流，无以成江海。</description>
	<lastBuildDate>Fri, 26 Feb 2016 18:13:34 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.9.3</generator>
	<item>
		<title>在.Net 环境下使用 MySQL</title>
		<link>https://www.williamkyle.com.cn/archives/102.html</link>
					<comments>https://www.williamkyle.com.cn/archives/102.html#respond</comments>
		
		<dc:creator><![CDATA[WilliamKyle]]></dc:creator>
		<pubDate>Thu, 09 Feb 2012 12:55:18 +0000</pubDate>
				<category><![CDATA[编程]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[MySql.Data.dll]]></category>
		<category><![CDATA[数据库]]></category>
		<guid isPermaLink="false">http://www.williamkyle.com.cn/?p=102</guid>

					<description><![CDATA[&#160; &#160; 要想在.Net 环境下使用 MySQL，必须引用 MySQL 的 Connecto &#8230; <a href="https://www.williamkyle.com.cn/archives/102.html" class="more-link">继续阅读<span class="screen-reader-text">在.Net 环境下使用 MySQL</span></a>]]></description>
										<content:encoded><![CDATA[<p>&nbsp; &nbsp; 要想在.Net 环境下使用 MySQL，必须引用 MySQL 的 Connector, 在 VS 中&ldquo; 项目&rdquo;-&gt;&ldquo; 添加引用&rdquo;-&gt;&ldquo; 浏览&rdquo;，选择&ldquo;MySql.Data.dll&rdquo;，然后在文件开头</p>
<pre class="brush:csharp;first-line:1;pad-line-numbers:true;highlight:null;collapse:false;">
using MySql.Data.MySqlClient; 
</pre>
<p>&nbsp;&nbsp;&nbsp;&nbsp; 这个 MySql.Data.dll 可以从 MySQL 的官方网站上得到，但是下载到的要不是一个源码的 zip 包，要不就是一个 10 几 M 的 msi 安装文件，里面包含了很多其他的东西，包括 Sample 等等，实际上这几个 dll 只有几百 K 而已。所以，我打包把它单独拿出来。<a href="http://www.williamkyle.com.cn/wp-content/uploads/ckfinder/files/v2_0.rar">v2.0.rar</a>&nbsp;&nbsp;<a href="http://www.williamkyle.com.cn/wp-content/uploads/ckfinder/files/v4_0.rar">v4.0.rar</a>&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;</p>
<pre class="brush:csharp;first-line:1;pad-line-numbers:true;highlight:null;collapse:false;">
using System;
using System.Collections.Generic;
using System.Text;
using MySql.Data.MySqlClient;

namespace MySQL
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                MySqlConnection conn = new MySqlConnection(&quot;server=Server;uid=User;pwd=Pass;database=Database&quot;);
                MySqlCommand cmd = new MySqlCommand(&quot;show databases;&quot;, conn);
                conn.Open();
                MySqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    Console.WriteLine(reader.GetValue(0).ToString());
                }                
                conn.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            Console.ReadKey();
        }
    }
}

</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://www.williamkyle.com.cn/archives/102.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
