自用學習寫的封裝庫 使用方法:Nuget中搜索HNGYSql 1.查詢數據方法 public string CommandSelect(string connectionString, string commandString) connectionString: 所連接的資料庫對象 command ...
自用學習寫的封裝庫
使用方法:Nuget中搜索HNGYSql
1.查詢數據方法
public string CommandSelect(string connectionString, string commandString)
connectionString: 所連接的資料庫對象
commandString: 所執行的查詢語句
作用:執行查詢語句
返回值為所查詢的結果(有多的空行,使用返回結果時註意切割字元串)
使用完自動釋放,無需close
Eg:
connectionString ="server=.;database=電影售票系統;uid=ojl;pwd=123456";
//.表示為本地連接,database對應資料庫名,uid和pwd對應登錄資料庫的賬號
commandString= "select * from table_customer";
結果:返回table_customer表的所有數據
2.通用執行命令方法(增刪改)
public bool CommandGeneral(string connectionString, string commandString)
connectionString: 所連接的資料庫對象
commandString: 所執行的命令語句
作用:執行功能語句
返回值為執行命令是否成功
使用完自動釋放,無需close
2.關閉連接方法(已廢棄)
public bool Close()