C# ODBC·ÃÎÊMySQLÊý¾Ý¿â
·Ï»°²»ËµÁË£¬Ö±½Ó½øÈëÖ÷Ì⣬C# ODBC·ÃÎÊMySQLÊý¾Ý¿â£º
1.°²×°Microsoft ODBC.net£ºÎÒ°²×°µÄÊÇmysql-connector-odbc-3.51.22-win32.msi
2.°²×°MDAC 2.7»òÕ߸ü¸ß°æ±¾£ºÎÒ°²×°µÄÊÇmdac_typ.exe 2.7¼òÌåÖÐÎÄ°æ
3.°²×°MySQLµÄODBCÇý¶¯³ÌÐò£ºÎÒ°²×°µÄÊÇ odbc_net.msi
4.¹ÜÀí¹¤¾ß -> Êý¾ÝÔ´ODBC –>ÅäÖÃDSN…
5.½â¾ö·½°¸¹ÜÀíÖÐÌí¼ÓÒýÓà Microsoft.Data.Odbc.dll(1.0.3300)
6.C# ODBC·ÃÎÊMySQLÊý¾Ý¿â´úÂëÖÐÔö¼ÓÒýÓà using Microsoft.Data.Odbc;
usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Drawing;
usingSystem.Linq;//vs2005ºÃÏñûÓÐÕâ¸öÃüÃû¿Õ¼ä£¬ÔÚc#2008ϲâÊÔ×Ô¶¯Éú³ÉµÄ
usingSystem.Text;
usingSystem.Windows.Forms;
usingMicrosoft.Data.Odbc;
namespacemysql{
publicpartialclassForm1:Form{
publicForm1(){
InitializeComponent();
}
privatevoidForm1_Load(objectsender,EventArgse){
stringMyConString
=
"DRIVER={MySQLODBC3.51Driver};"
+
"
SERVER
=
localhost
;"+
"
DATABASE
=
inv
;"+
"
UID
=
root
;"+
"
PASSWORD
=
831025
;"+
"
OPTION
=
3
";
OdbcConnectionMyConnection
=
newOdbcConnection
(MyConString);
MyConnection.Open();
Console.WriteLine("\nsuccess,connectedsuccessfully!\n");
stringquery
=
"insertintotestvalues('hello','lucas','liu')"
;
OdbcCommandcmd
=
newOdbcCommand
(query,MyConnection);
//´¦ÀíÒì³££º²åÈëÖظ´¼Ç¼ÓÐÒì³£
try{
cmd.ExecuteNonQuery();
}
catch(Exceptionex){
Console.WriteLine("recordduplicate.");
}
finally{
cmd.Dispose();
}
stringtmp1
=
null
;
stringtmp2
=
null
;
stringtmp3
=
null
;
query
=
"select*fromtest"
;
OdbcCommandcmd2
=
newOdbcCommand
(query,MyConnection);
OdbcDataReaderreader
=
cmd
Ïà¹ØÎĵµ£º
ÒòΪÏîÄ¿ÒªÇó£¬ÖÆ×÷µÄÒ»¸ö¶àÎļþÉÏ´«£¬²¢ÏÔʾ½ø¶ÈÌõÒ»¶Î´úÂë(vs2005»·¾³)¡£
(ֻΪ´ÖÂÔµÄʵÏÖ£¬´úÂë²¢²»¹æ·¶)
µ±¶à¸öÎļþÉÏ´«µÄʱºò£¬ÐèÒªÒÀ´Î¶ÓÁÐÐÎʽһ¸ö¸öÉÏ´«£¬µ±ÉÏ´«Ä³¸öÎļþµÄʱºò£¬Ëø¶¨½ø³Ì£¬ÉÏ´«Íê±ÏÔÙ¿ªÆôËø¡£
ÔÚÖ÷ÀàÖеÄÉÏ´«°´Å¥Ê¼þ´úÂë:
//
»ñÈ¡openFileDialog¿Ø¼þÑ¡ÔñµÄÎļþÃûÊý×é(openFileDialog¿É ......
<p>04¼¶ÐÂÉúÃûµ¥</p>
<table border="1" width="80%" cellpadding="0">
<tr>
<td width="10%" align="center">Id</td>
<td width="20%" align="center">Name</td>
<td width="10%" align="center">Age</td>
<td width="10%" align="cent ......
mysql ±¸·ÝºÍ»Ö¸´²ßÂÔ
ÎÄÕ·ÖÀà:Êý¾Ý¿â
ÔÚÊý¾Ý¿â±í¶ªÊ§»òË𻵵ÄÇé¿öÏ£¬±¸·ÝÄãµÄÊý¾Ý¿âÊǺÜÖØÒªµÄ¡£Èç¹û·¢Éúϵͳ±ÀÀ££¬Äã¿Ï¶¨ÏëÄܹ»½«ÄãµÄ±í¾¡¿ÉÄܶªÊ§×îÉÙµÄÊý¾Ý»Ö¸´µ½±ÀÀ£·¢ÉúʱµÄ״̬¡£±¾ÎÄÖ÷Òª¶ÔMyISAM±í×ö±¸·Ý»Ö¸´¡£
±¸·Ý²ßÂÔÒ»£ºÖ±½Ó¿½±´Êý¾Ý¿âÎļþ£¨²»ÍƼö£©
±¸·Ý²ßÂÔ¶þ£ºÊ¹ÓÃmysqlhotcopy±¸·ÝÊý¾Ý¿â£ ......
Ò»¡¢IPÐÅÏ¢ÁÐ±í£º
Ãû³Æ IP
LVS-DR-VIP 192.168.50.245
LVS-DR-Master ......
OracleÓëMySQLÖГ¿É´®Ðл¯”µÄ¶Ô±È²âÊÔ
Thomas Kyte ÔÚ“Oracle 9i&10g±à³ÌÒÕÊõ”Ò»ÊéÖÐΪÁË˵Ã÷ÊÂÎñµÄ¸ôÀ뼶±ð£¬ÌṩÁËһЩÀý×Ó¡£ÕâÀïÎÒÃÇÀ´¿´¿´“¿É´®Ðл¯”¼¶±ðϵıíÏÖ¡£
ÒÔÆÕͨÓû§µÇ¼ϵͳ£¬²¢´´½¨²âÊÔÓÃµÄ±í¡£
idle> connect scott/tiger
......