自己封裝的SQLSERVER 資料操作類

2021-08-30 12:26:23 字數 1719 閱讀 1303

** 作者 : vernon start

* * 建立時間 :2010-3-5

* * email : [email protected]

* * 說明 : 對資料操作的乙個類 增,刪,改,查

* * */

using system;

using system.collections.generic;

using system.text;

using system.data.sqlclient;

using system.data;

using system.configuration;

namespace dal

return conn;

}///

/// 關閉連線釋放資源

///

/// 無返回方法

public void closeconnedction(sqlconnection conn)

}///

/// 該方法執行增,刪,改操作

///

///

/// 返回個bool型別

public int getexecunonquery(string sql)

catch (sqlexception ex)

finally

}///

/// 帶引數的增加新聞類別

///

/// 傳乙個sql語句

/// 傳乙個引數陣列

/// 返回int型別

public int getexecutenonquery(string sql, sqlparameter spras)

return cmd.executenonquery();

}///

/// 該方法執行第一行第一列 

///

///

/// 返回int型別 

public int getexecutescalarg(string sql)

catch (exception ex)

finally

}///

/// 該方法執行型別查詢

///

/// 型別

/// 引數集合

///

///

public datatable getdatatable(string cmdtext,sqlparameter paras,commandtype ct)

return dt;

}catch (sqlexception ex)

}///

/// 該方法執行普通型別查詢

///

///

///

public datatable getdatatables(string cmdtext )

return dt;

}catch (sqlexception ex)

}///

/// 該方法是乙個資料集方法再很多地方用得到的 

///

/// 第乙個引數是傳sql語句

/// 第二個引數是傳資料庫當中的表名

///

public dataset getdataset(string sql, string table)

catch (exception ex)

finally}}

}

自己封裝的ajax

itcast web created by lsy on 2016 5 24.1.請求的型別 type get post 2.請求位址 url 3.是非同步的還是同步的 async false true 4.請求內容的格式 contenttype 5.傳輸的資料 data json物件 6.響應成功...

mysql dao封裝 自己封裝的簡單DbDao

首先,dbdao是乙個用來運算元據庫的類。需要對資料庫的驅動包 要運算元據庫首先要獲得鏈結,這時候就需要鏈結資料庫的所有引數了,包括driver,url,user,password。全部定義為private static string 第一步,載入驅動。其實載入驅動只需要進行一次,不需要每次鏈結都載...

封裝自己DB

db.class.php created by phpstorm.user brady.wang date 2017 11 10 time 18 00 封裝乙個db類,用來專門運算元據庫,以後凡是對資料庫的操作,都由db類的物件來實現 class db 連線資料庫 private function ...