自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

C# 鏈接MySQL數(shù)據(jù)庫的實(shí)現(xiàn)步驟有哪些?

數(shù)據(jù)庫 MySQL
以下的文章主要是以實(shí)例描述的方式來引出C# 鏈接MySQL數(shù)據(jù)庫的實(shí)際操作,以及對(duì)其實(shí)際操作中的相關(guān)事項(xiàng)的詳細(xì)介紹。

此文章抓主要介紹的是C# 鏈接MySQL數(shù)據(jù)庫的實(shí)際操作方案,以及在其實(shí)際操作中值得我們大家注意的幾個(gè)方面的描述,本文主要是以實(shí)例的方式來引出C# 鏈接MySQL數(shù)據(jù)庫的實(shí)際操作流程。

C# 鏈接MySQL數(shù)據(jù)庫只得注意的幾點(diǎn):

1、C#鏈接MySQL數(shù)據(jù)庫要在網(wǎng)上下載一個(gè)MySQL-connector-net-6.0.4-noinstall.rar 這里面放的都是一堆dll .將他們?nèi)糠旁赑rojectBin 然后在VS里引入一下就OK啦~ 對(duì)了MySQL.data.cf.dll這個(gè)除外(不要引用)

2、進(jìn)行數(shù)據(jù)庫鏈接的時(shí)候注意了,c#鏈接MySQL是和鏈接SQl的代碼是不一樣的。

c#鏈接MySQL數(shù)據(jù)庫是這樣的:

string MySQLString = "User Id=a;pwd=a;Host=服務(wù)器;Port=服務(wù)器端口號(hào);Database=數(shù)據(jù)庫;Character Set=utf8";

 

下面試個(gè)實(shí)例:

 

 

  1. using MySQL.Data.MySQLClient;  
  2. namespace Discuz  
  3. {  
  4. public partial class _Default : System.Web.UI.Page  
  5. {  
  6. protected void Page_Load(object sender, EventArgs e)  
  7. {  
  8. if (!Page.IsPostBack)  
  9. {  
  10. this.Bind();  
  11. }  
  12. }  
  13. public void Bind()  
  14. {  
  15. string MySQLString = "User Id=dis;pwd=sa;Host=1.2.3.4;Port=6033;Database=dis;Character Set=utf8";  
  16. MySQLConnection conn = new MySQLConnection(MySQLString);  
  17. conn.Open();  
  18. string bb = "SELECT p.author, p.message FROM cdb_threads AS t INNER JOIN cdb_posts AS p ON t.tid = p.tid where t.fid = 34 and digest !=0";  
  19. MySQLDataAdapter sda = new MySQLDataAdapter(bb, conn);  
  20. DataSet ds = new DataSet();  
  21. sda.Fill(ds, "T");  
  22. this.GridView1.DataSource = ds;  
  23. this.GridView1.DataBind();  
  24. conn.close();  
  25. }  
  26. }  
  27. }  

 

以上的相關(guān)內(nèi)容就是對(duì)C# 鏈接MySQL數(shù)據(jù)庫的介紹,望你能有所收獲。

原文標(biāo)題:C# 鏈接MySQL數(shù)據(jù)庫

連接:http://www.cnblogs.com/tsliup/archive/2010/01/14/1647863.html

【編輯推薦】

  1. jsp MySQL 中的中文問題的實(shí)際解決
  2. .NET訪問MySQL數(shù)據(jù)庫的經(jīng)驗(yàn)漫談
  3. Java連接MySQL 數(shù)據(jù)庫的連接步驟
  4. MySQL存儲(chǔ)過程的創(chuàng)建步驟描述
  5. MySQL 數(shù)據(jù)庫命令的實(shí)際操作流程

 

責(zé)任編輯:佚名 來源: 博客園
相關(guān)推薦

2010-06-12 10:49:12

2010-05-04 14:20:47

Oracle創(chuàng)建數(shù)據(jù)庫

2010-06-04 10:05:55

MySQL數(shù)據(jù)庫還原

2009-08-12 14:23:01

C#連接MySql數(shù)據(jù)

2009-08-12 14:27:36

訪問MySQL數(shù)據(jù)庫C# ODBC

2010-05-14 14:38:03

安裝MySQL

2009-08-25 15:22:18

C#連接SQL數(shù)據(jù)庫

2010-05-31 10:56:48

MySQL數(shù)據(jù)庫

2009-08-28 15:16:32

C#實(shí)現(xiàn)對(duì)數(shù)據(jù)庫訪問

2010-05-19 17:35:35

2009-08-28 16:19:30

C#實(shí)現(xiàn)修改動(dòng)態(tài)鏈接庫

2010-03-26 13:15:28

Python嵌入c

2024-04-03 00:06:03

2010-05-21 16:33:02

MySQL數(shù)據(jù)庫

2010-05-26 10:51:50

連接MySQL數(shù)據(jù)庫

2009-08-10 18:00:30

C#數(shù)據(jù)庫備份及還原

2009-08-11 13:35:13

C# Berkeley

2024-04-18 09:56:16

2010-05-20 16:44:18

卸載MySQL

2010-05-13 13:49:09

MySQL數(shù)據(jù)庫
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)