C#Á¬½ÓMySQLÊý¾Ý¿â·½·¨
C#Á¬½ÓMySQLÊý¾Ý¿â·½·¨
1¡¢ÓÃMySQLDriverCSÁ¬½ÓMySQLÊý¾Ý¿âÏÈÏÂÔغͰ²×°MySQLDriverCS£¬µØÖ·£º
http://sourceforge.net/projects/mysqldrivercs
ÔÚ°²×°Îļþ¼ÐÏÂÃæÕÒµ½MySQLDriver.dll£¬È»ºó½«MySQLDriver.dllÌí¼ÓÒýÓõ½ÏîÄ¿ÖÐ
×¢£ºÎÒÏÂÔصÄÊÇ°æ±¾ÊÇ MySQLDriverCS-n-EasyQueryTools-4.0.1-DotNet2.0.exe
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Odbc;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MySQLDriverCS;
namespace mysql
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
MySQLConnection conn = null;
conn = new MySQLConnection(new MySQLConnectionString("localhost", "inv", "root", "831025").AsString);
conn.Open();
MySQLCommand commn = new MySQLCommand("set names gb2312", conn);
commn.ExecuteNonQuery();
string sql = "select * from exchange ";
MySQLDataAdapter mda = new MySQLDataAdapter(sql, conn);
DataSet ds = new DataSet();
mda.Fill(ds, "table1");
Ïà¹ØÎĵµ£º
´ËÎÄÕÂÖ÷ÒªÃèÊöµÄÊÇMySQLÊý¾ÝÀàÐÍÓ뽨¿â²ßÂÔµÄÏêϸ½âÎö£¬ÎÒÃÇ´ó¼Ò¶¼ÖªµÀÎÞÂÛÊÇÔÚ²»ÊշѵÄÊý¾Ý¿â¿Õ¼ä»òÕßÊÇ´óÐ͵ĵç×ÓÉÌÎñÍøÕ¾£¬ÆäºÏÀíµÄÉè¼Æ±í½á¹¹¡¢³ä·ÖÀûÓÿռäÊÇÊ®·Ö±ØÒªµÄ¡£
¡¡¡¡Õâ¾ÍÒªÇóÎÒÃǶÔÊý¾Ý¿âϵͳµÄ³£ÓÃMySQLÊý¾ÝÀàÐÍÓгä·ÖµÄÈÏʶ¡£ÏÂÃæÎҾͽ«ÎÒµÄÒ»µãÐĵÃд³öÀ´¸ú´ó¼Ò·ÖÏí¡£
¡¡¡¡Ò»¡¢MySQLÊý¾ÝÀàÐÍÖ®Êý×ÖÀàÐ ......
ÎÊÌâÃèÊö£º
C#³ÌÐò,ÀïÃæcopyÁËÐí¶àÔÀ´µÄ´úÂë,ËùÒԲβÆëµÄ,ºÜÄѶÁ,ÈçºÎ²ÅÄÜÈôúÂë×Ô¶¯ÅÅÆë,¾ÍÏóVS 6.0ÖпÉÒÔʹÓÿì½Ý¼ü,·Ç³£·½±ã.
½â´ð£º
ctrl+a,ÏÈÈ«Ñ¡
ctrl+k,ctrl+f,×Ô¶¯ÅÅÁÐ
»òÕß
ctrl+a,ÏÈÈ«Ñ¡
alt+F8 ×Ô¶¯ÅÅÁÐ ......
/// <summary>
/// ¸ù¾ÝÖ¸¶¨²ÎÊý·µ»ØBitMap¶ÔÏó
/// ÒýÓÃÈçÏ£º
/// using System.Drawing;
/// µ÷ÓÃÀý×ÓÈçÏ£º
......
°æȨÉùÃ÷
£º×ªÔØʱÇëÒÔ³¬Á´½ÓÐÎʽ±êÃ÷ÎÄÕÂÔʼ³ö´¦ºÍ×÷ÕßÐÅÏ¢¼°±¾ÉùÃ÷
http://bbayou.blogbus.com/logs/37045617.html
²âÊÔÊý¾Ý2.5G£¬¹²ÓÐÊý¾Ý9427567Ìõ¡£ÓõÄmysqlµÄlarge·þÎñÆ÷µÄÅäÖá£
load
Ò»´ÎÐèÒª´ó¸Å10·ÖÖÓ×óÓÒ¡£
½¨µÄ±íÓõÄÊÇMYISAM£¬µ÷ÕûÁ˼¸¸ösessionµÄ²ÎÊýÖµ
SET
SESSION
BULK_INSERT_BUFFER_S ......
1¡¢MySQLÊÇÓÐһЩ»·¾³±äÁ¿¿ÉÒÔÉèÖã¬
¿ÉÊäÈ룺show variables;¿É²é¿´µ±Ç°µÄ»·¾³±äÁ¿ÉèÖã»
2¡¢ÕâЩ±äÁ¿µ±ÖÐÓÐÒ»²¿·ÖÓë×Ö·ûÏà¹ØµÄÉèÖã¬
¿ÉÊäÈ룺show variables like ´character%´;²é¿´£»
3¡¢ÆäÖÐcharacter_set_results¾ö¶¨·µ»Ø½á¹ûµÄ±àÂ룬
windowsÏÂÉèΪgb2312¼´¿ÉÕý³£ÏÔʾÖÐÎÄ£»
ÉèÖ÷½·¨£ºset charac ......