Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

C#Á¬½ÓMySQL½øÐвÙ×÷µÄ·½·¨

ÓÉÓÚÐèҪʵÏÖÒÔϹ¦ÄÜ£º
Íø¹ØÍ¨¹ý´®¿Ú·¢ËÍÊý¾Ý¸øPC»ú£¬PC»úÊÕ¼¯Êý¾Ý²¢½âÎö±£´æµ½MySQLÖУ¬È»ºóJSPÒ³Ãæ¶ÁÈ¡MySQLÖеÄÊý¾Ý²¢ÏÔʾ¡£
ËùÒÔÀûÓÃC#Á¬½ÓMySQLÊý¾Ý³ÉΪÁ˱ØÐëÒª¾­¹ýµÄ¹ý³Ì£¬Ôڴ˸øÓèÏêϸµÄ˵Ã÷¡£
1¡¢ÏÂÔØÐèÒªµÄÎļþMySQLDriverCS£¬ÏÂÔØµØÖ·Îª£ºhttp://sourceforge.net/projects/mysqldrivercs
2¡¢°²×°Îļþ£ºMySQLDriverCS-n-EasyQueryTools-4.0.1-DotNet2.0.exe£¬ÔÚ°²×°¹ý³ÌÖÐÒ²Ðí»áÌáʾһ¸ö´íÎ󣬽ûֹдһ¸ödllÎļþ£¬ÄãÖ±½ÓºöÂԾͿÉÒÔÁË¡£
3¡¢½«°²×°ÎļþϵÄMySQLDriver.dllÎļþÌí¼Óµ½C#ÏîÄ¿µÄÒýÓÃÖС£
4¡¢È»ºóд¹«¹²´¦ÀíÀàÈçÏ£º
(1) Ê×ÏȵÃÒýÓÃÃüÃû¿Õ¼ä£º
using MySQLDriverCS;
using System.Data;
using System.Data.Odbc;
(2) д¹«¹²´¦ÀíÀà
public class SQLHelper
{
MySQLConnection conn = null;
MySQLCommand commn = null;

public MySQLConnection GetConnect()
{
conn = new MySQLConnection(new MySQLConnectionString("localhost", "wwater", "root", "123").AsString);
return conn;
}
public int RunMySQL(string sql)
{
int count = 0;
try
{
conn = GetConnect();
conn.Open();
commn = new MySQLCommand(sql, conn);
count = commn.ExecuteNonQuery();
return count;
}
catch (Exception ex)
{
throw;
}
finally
{
conn.Close();
}
}
}
(3) ÔÚʵ¼Ê¹ý³ÌÖнøÐÐÒýÓÃRunMySQL·½·¨¼´¿É²åÈëÊý¾ÝÁË¡£  


Ïà¹ØÎĵµ£º

mysql Ë÷Òý

1
Ë÷ÒýµÄÒâÒ壺
Óŵ㣺
Ë÷ÒýÓÃÀ´¿ìËÙµØÑ°ÕÒÄÇЩ¾ßÓÐÌØ¶¨ÖµµÄ¼Ç¼£¬Èç¹ûûÓÐË÷Òý£¬Ö´Ðвéѯʱ±ØÐë´ÓµÚÒ»¸ö¼Ç¼¿ªÊ¼É¨Ãè±íÖÐËùÓмǼ£¬±íÀïÃæµÄ¼Ç¼ÊýÁ¿Ô½¶à£¬Õâ¸ö²Ù×÷µÄ´ú¼Û¾ÍÔ½¸ß¡£
    
ȱµã£º
Ë÷ÒýÒªÕ¼ÓôÅÅ̿ռ䣻ÇÒÈκÎд²Ù×÷Éæ¼°µÄË÷Òý¸öÊý¶àµÄ»°»áÒýÆð½µËÙ£¬ÒòΪ
MySQL
²»½öÒª°Ñ¸Ä¶¯Êý¾ ......

C#´¦Àíoracle lobµÄÀý×Ó

  protected void BindData1()
    {
        OracleConnection orcn = new OracleConnection("User ID=wesoftwcp; Password=wesoft; Data Source=oradb");
        orcn.Open();
      &nb ......

Mysql limitÓ÷¨

1.SELECT
 
*
 
from
 
table
 LIMIT
1
,
20
;  
//
 ¼ìË÷¼Ç¼ÐÐ
2-21
   µÚÒ»¸ö²ÎÊý£º²éѯÆðʼÐУ¨´Ó0¿ªÊ¼£©
   µÚ¶þ¸ö²ÎÊý£º²éѯ¼¸Ìõ¼Ç¼
2.
SELECT
 
*
 
from
 
table
 LIMIT
5
,
-
1

//
&nbs ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ