ÀûÓÃMySQLDriverCSʵÏÖÔÚ.NET»·¾³Ï·ÃÎÊMySQLÊý¾Ý¿â
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MySQLDriverCS;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
MySQLConnection conn = null;
conn = new MySQLConnection(new MySQLConnectionString("127.0.0.1", "Dvbbs", "root", "123456").AsString);
conn.Open();
MySQLCommand commn = new MySQLCommand("set names gb2312",conn);
commn.ExecuteNonQuery();
string sql = "select title,topicID, boardId ,dateandtime,hits from Dv_topic order by dateandtime desc limit 10";
MySQLDataAdapter mda = new MySQLDataAdapter(sql,conn);
DataSet ds = new DataSet();
mda.Fill(ds, "table1");
this.Repeater1.DataSource = ds;
this.Repeater1.DataBind();
conn.Close();
}
}
¾ÍÕâÑù¾Í¿ÉÒÔʵÏÖÔÚ.NET»·¾³Ï¶ÔMySQLÊý¾ÝµÄ·ÃÎÊ¡£ÔÚÕâ֮ǰ»¹Òª×öһЩ׼±¸£¬ÏÂÔØMySQLDriverCS£¬°²×°£¬ÔÚ°²×°Îļþ¼ÐÏÂÃæÕÒµ½MySQLDriver.dll£¬È»ºó½«MySQLDriver.dllÌí¼ÓÒýÓõ½ÏîÄ¿ÖоÍOKÁË¡£Ò²ÐíÄã¶ÔÕâÐдúÂë
MySQLCommand commn = new MySQLCommand("set names gb2312",conn);
commn.ExecuteNonQuery();
²»Ì«Àí½â¡£ÕâÊÇÒòΪÈç¹ûûÓÐÕâ¾ä»
Ïà¹ØÎĵµ£º
1.ʲôÊÇUDF? UDF(user-defined function)ÊÇmysqlΪÓû§ÌṩµÄ×Ô¶¨Ò庯ÊýµÄÀ©Õ¹½Ó¿Ú¡£Ëü±¾ÖÊÉϺÍmysqlÌṩµÄmax¡¢minºÍcountµÈº¯ÊýÀàËÆ¡£ 2.UDF¿ÉÒÔ×öʲô? UDFÊÇ×Ô¶¨Ò庯Êý£¬ËùÒÔËüÄÜ×öʲôÍêȫȡ¾öÓÚÄãµÄʵÏÖ¡£UDF¿ÉÒÔÔÚÆÕͨµÄsql¡¢triggerÒÔ¼°store procedure±»µ÷ÓᣠÈç¹û×Ô¶¨ÒåÒ»¸ötcp_send(ip,port,msg)µ ......
ÔÚÖ÷Íâ¼ü±í´æÔÚ¹ØÏµµÄʱºòÈç¹û¼ÓÉÏ"lazy=true"µÄ»°£¬Ôò±íÃ÷ÑÓ³Ù£¬¼´Ö»²éѯÖ÷±íÖеÄÄÚÈÝ£¬¶ø²»²éѯÍâ¼ü±íÖеÄÄÚÈÝ¡£
Àý£º
<hibernate-mapping>
<class name="com.pojo.Sortp" table="sortp" catalog="shjdc">
<id name="id" type= ......
Ò»¡¢mysql·þÎñ²Ù×÷
1¡¢net start mysql //Æô¶¯mysql·þÎñ
2¡¢net stop mysql //Í£Ö¹mysql·þÎñ¡¡
3¡¢mysql -hÖ÷»úµØÖ· -uÓû§Ãû £pÓû§ÃÜÂë //½øÈëmysqlÊý¾Ý¿â
4¡¢quit //Í˳ömysql²Ù×÷
5¡¢mysqladmin -uÓû§Ãû -p¾ÉÃÜÂë password ÐÂÃÜÂë //¸ü¸ÄÃÜÂë
6¡¢grant select on Êý¾Ý¿â.* to Óû§Ãû@µÇ¼Ö÷»ú identifie ......
1.ÉèÖñäÁ¿
set @x = 2;
»ò:
select @x := max(fields) as max from table;
2.Éú³Éhtml»òxml
mysql -H -uroot -p databaseName Éú³ÉhtmlÎļþ
mysql -x -uroot -p databaseNam ......
[root@sql21 ~]# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 5.1.26-rc-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show databases;
+--------------------+
| Database &nb ......