<?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>MySql.Data.dll &#8211; WilliamKyle&#039;s Home</title>
	<atom:link href="https://www.williamkyle.com.cn/archives/tag/mysql-data-dll/feed" rel="self" type="application/rss+xml" />
	<link>https://www.williamkyle.com.cn</link>
	<description>不积跬步，无以至千里；不积小流，无以成江海。</description>
	<lastBuildDate>Fri, 08 Apr 2022 14:30:44 +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[要想在.Net环境下使用MySQL，必须引用MySQL的Connector, 在VS中“项目”->“添加引用” &#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>要想在.Net环境下使用MySQL，必须引用MySQL的Connector, 在VS中“项目”->“添加引用”->“浏览”，选择 “MySql.Data.dll”，然后在文件开头</p>



<pre class="wp-block-code has-dark-gray-color has-text-color"><code lang="csharp" class="language-csharp">using MySql.Data.MySqlClient; </code></pre>



<p>这个 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>  <a href="http://www.williamkyle.com.cn/wp-content/uploads/ckfinder/files/v4_0.rar">v4.0.rar</a>       </p>



<pre class="wp-block-code has-dark-gray-color has-text-color"><code lang="csharp" class="language-csharp">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("server=Server;uid=User;pwd=Pass;database=Database");
                MySqlCommand cmd = new MySqlCommand("show databases;", 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();
        }
    }
}

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