使用EnterPrise2 0封裝的資料訪問類

2021-04-14 17:14:44 字數 2868 閱讀 9500

在專案開發中,資料庫的訪問是乙個最基本的操作,於是在專案開發中,總結出了乙個資料庫訪問類,使用的enterprise library 2.0 。**如下:

using system;

using system.collections.generic;

using system.text;

using system.data;

using microsoft.practices.enterpriselibrary;

using microsoft.practices.enterpriselibrary.common;

using microsoft.practices.enterpriselibrary.data;

using system.data.common;

using system.data.sqlclient;

namespace demo

db.loaddataset(dbc, dataset, tablename);

}catch

}public static dbconnection getcon()

///

/// 使用sql語句返回資料集

///

/// sql語句

/// 資料集合

/// 表名陣列

///

public static void filldataset_sql(string strsql, sqlparameter paramvalues, dataset dataset, string tablename));}

catch

}///

/// 使用sql語句返回資料集

///

/// sql語句

/// 資料集合

/// 表名陣列

///

public static dataset filldataset_sql(string strsql, sqlparameter paramvalues)

return db.executedataset(dbc);

}catch

}#endregion

#region filldataset_proc

///

/// 使用儲存過程返回資料集

///

/// 儲存過程

/// 儲存過程引數陣列

/// 資料集合

/// 表名陣列

///

public static void filldataset_proc(string strstoredprocedurename, sqlparameter sqlparm, dataset dataset, string tablenames)

//執行儲存過程返回資料集

db.loaddataset(dbc, dataset, tablenames);

}catch

}///

/// 使用儲存過程返回資料集

///

/// 儲存過程

/// 儲存過程引數陣列

/// 資料集合

/// 表名陣列

///

public static void filldataset_proc(string strstoredprocedurename, sqlparameter sqlparm, dataset dataset, string tablenames));}

catch

}///

/// 使用儲存過程返回資料集

///

/// 儲存過程

/// 儲存過程引數陣列

/// 資料集合

/// 表名陣列

///

public static dataset filldataset_proc(string strstoredprocedurename, sqlparameter sqlparm)

//執行儲存過程返回資料集

return db.executedataset(dbc);

}catch

}#endregion

#region excutenonquery_sql

///

/// 使用sql語句返回資料集

///

/// sql語句

///

public static int excutenonquery_sql(string strsql, sqlparameter paramvalues)

int i = db.executenonquery(dbc);

return i;

}#endregion

#region excutenonquery_pro

///

/// 執行儲存過程返回是否執行成功

///

///

///

///

public static bool excutenonquery_pro(string strprocedurename, sqlparameter sqlparm)

i = db.executenonquery(dbc);

return true;

}#endregion

#region executescale

///

/// 執行儲存過程返回第一行,第一列的值

///

///

///

public static object executescale(string strname, sqlparameter param)

return db.executescalar(dbc);

}#endregion

}#endregion

}

vue2 0封裝axios請求

vue封裝網路模組 第一步 在scr裡面建立乙個network資料夾,在network資料夾裡面建立三個檔案 第二步 第乙個資料夾 config.js,在裡面寫入以下 定義請求方式 export const method export const path 第二個資料夾 core.js 在裡面寫入以...

javascript Ajax 基本使用和封裝

1.例項化ajax物件 2.監聽狀態改變事件 xhr.onreadystatechange function 3.初始化請求的引數 open 請求方式 請求位址 是否非同步true 非同步,false 同步 xhr.open post index.php?id 1 name user1 true 請...

Kakfa安裝使用,springboot封裝

啟動安裝配置完成,先啟動zookeeper然後後台啟動kakfa。nohup bin kafka server start.sh config server.properties kafka.log partions和replication factor引數的理解 簡單shell命令 建立 副本為1...