C 操作Mysql混合開發

2021-06-29 15:55:47 字數 2213 閱讀 3533

c#訪問mysql資料庫的方法

(2)安裝mysql-connector-net

然後直接在windows作業系統安裝mysql-connector-net-6.3.8.msi

預設是安裝在c盤:

c:\program files\mysql\mysql connector net 6.3.8\assemblies

v2.0

v4.0

安裝完後我選擇的是v2.0版本的

然後在應用工程中引用元件mysql.data.dll

(3)封裝資料庫訪問元件dbconnectionmysql

/// /// mysql資料庫   

/// 版本 mysql-connector-net-6.3.8.msi  

/// vp:hsg  

/// create date:2012-02-28  

///   

[serializable]  

//--  

public override dbdataadapter getdbdataadapter()  

public override dbdataadapter getdbdataadapter(dbcommand dbcommand)  

public override dbcommand getdbcommand()  

public override dbconnection getdbconnection()  

public override dbcommandbuilder getdbcommandbuilder()  

public override dataprovidertype getcurrentdataprovidertype()  

public override bool i***iststable(string tablename, string username)  

else  

}  else  

return rbc;  

#endregion  

}  public override bool i***istsfield(string fieldname, string tablename)  

}  dt.dispose();  

dt = null;  

}  ds.dispose();  

ds = null;  

return_end:  

return rbc;  

#endregion  

}  public override char parameterchar  

}  public override dbparameter createparameter(string name, object value)  

public override dbparameter createparameter(string name)  

public override dbparameter createparameter(string name, dbtype dbtype, object value)  

public override dbparameter createparameter(string name, dbtype dbtype, int size, object value)  

}

(4)客戶端訪問測試開發例項

[csharp] view plaincopy

public void testcshape_mysql()  

//插入語句  

x = "insert into xp_users(gid,uid,uname,***,email,pwd) values('";  

x += "1','hsg77','何***',1,'[email protected]','1')";  

if (dbw.executequery(x) > 0)  

//查詢語句  

datatable dt = dbw.executedatatable("select * from xp_users");  

if (dt != null && dt.rows.count > 0)  

if (dt != null)  

dbw.dispose();  

dbw = null;  

}

——————歐克了!

c 的mysql操作 C操作mysql

if defined win32 defined win64 為了支援windows平台上的編譯 include endif include include include include mysql.h 我的機器上該檔案在 usr local include mysql下 定義資料庫操作的巨集,也...

Hybird APP (混合開發)簡介

第四類應用理論上講已經不太能歸類到hybrid開發的範疇了。這類應用使用了頁面動態化框架,可以讓native通過執行動態化的指令碼 可以本地也可以下發 但渲染出native的介面和邏輯。最出名的框架就是facebook的react native了,當然,每個大廠都會有自己造的輪子,比如阿里系的wee...

React Native 混合開發 mac環境部署

touch package.json,dependencies 在這裡可以react nativa init project 乙個新專案,然後將裡面的package.json拷貝過來 npm install touch index.ios js flow import react,from reac...