Mysql雨松工具类使用
資源窗口視圖
腳本:
場景例子
普通增刪改查例子
Mysql核心工具類
?
?
?
主要功能
?
?
創(chuàng)建表
private void CreateTable()
{
SqlAccess sql = new SqlAccess();
sql.CreateTable("Infomation", new string[] { "name", "id", "password" }, new string[] { "text", "int", "text" });
sql.Close();
}
插入數(shù)據(jù)
private void Insert()
{
SqlAccess sql = new SqlAccess();
sql.InsertInto("login", new string[] {"name","id","password" },new string[] {"456","2","456" });
sql.Close();
}
刪除數(shù)據(jù)
private void Delete()
{
SqlAccess sql = new SqlAccess();
?
sql.Delete("login", new string[] {"id"}, new string[] {"2"});
?
sql.Close();
}
更新數(shù)據(jù)
private void UpdateInfo()
{
SqlAccess sql = new SqlAccess();
?
sql.UpdateInto("login", new string[] { "name", "id", "password" }, new string[] { "789", "789", "789" }, "id", "1");
sql.Close();
}
查找數(shù)據(jù)
private void Select()
{
SqlAccess sql = new SqlAccess();
DataSet ds = sql.SelectWhere("login", new string[] { "name", "password" }, new string[] { "id" }, new string[] { "=" }, new string[] { "1" });
?
if (ds != null)
{
DataTable table = ds.Tables[0];
foreach (DataRow row in table.Rows)
{
foreach (DataColumn column in table.Columns)
{
print(row[column]);
}
?
}
}
sql.Close();
?
}
?
private void SelectOne()
{
SqlAccess sql = new SqlAccess();
DataSet ds = sql.SelectWhere("login", new string[] { "name", "password" }, new string[] { "name" }, new string[] { "=" }, new string[] { "123" });
if (ds != null)
{
DataTable table = ds.Tables[0];
string str = table.Rows[0][table.Columns[1]].ToString();
}
sql.Close();
?
}
數(shù)據(jù)庫表中結(jié)構(gòu)圖
?
?
?
?
源地址:http://www.xuanyusong.com/archives/2326。
總結(jié)
以上是生活随笔為你收集整理的Mysql雨松工具类使用的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: SteamVR 工具包VRTK实例解析
- 下一篇: EventTrigger接管所有事件导致