SqlHelper基於微軟官方的Helper

2021-10-06 15:46:21 字數 1493 閱讀 6774

基於微軟官方的helper, 把常用的方法封裝出來, 簡化操作

public class sqlhelper

return _connstring;}}

///----------------資料庫指令碼工具------------------------------------

public static int executenonquery(string sql)

public static string executequerystring(string sql)

public static datatable executequery(string sql)

else

}public static datatable executequery(string sql, idbdataparameter dbparameters)

else

}public static dataset executequerydataset(string sql)

public static datatable runproctable(string procname, sqlparameter dbparameters)

else

}public static dataset runproc(string procname, sqlparameter dbparameters)

public static int runproc(string procname)

/// /// 執行多條sql語句,實現資料庫事務。

///

/// 多條sql語句

public static void executesqltran(arraylist sqlstringlist)

}tx.commit();

}catch (sqlexception e)}}

/// ///自定義連線 執行多條sql語句,實現資料庫事務。

///

/// 多條sql語句

public static void executesqltran(string connstring, arraylist sqlstringlist)

}tx.commit();

}catch (sqlexception e)}}

//從datatable批量插入資料到表中

public static void sqlbulkcopydata(datatable dt, string tablename, dictionarycolmap)

//將資料批量插入表中

copy.writetoserver(dt);}}

public static bool isnull(datatable dt)

return false;

}public static bool isnull(dataset ds)

return false;

}}

微軟SqlHelper詳細解讀

發現很少有人使用微軟sqlhelper,大多數人都是自己實現或把微軟的進行閹割。其原因大概有以下幾個 1 有些人認為微軟的sqlhelper很多東西沒有必要,擔心影響效能。2 微軟的sqlhelper有60多個方法,加上快取類有70多個。由於類的方法的低耦合使得原始碼閱讀困難。3 自己實現也不難,因...

微軟官方WinPE

三 隨後的選項 windows預安裝環境 windows pe 是一定要勾選的,至於其他的工具看個人喜好了。六 首先輸入以下命令開始提取winpe映象,此時會刷屏,等出現結果顯示後再進行操作。copype amd64 c winpe amd64 接下來使用命令載入winpe映象 dism mount...

揭秘Kinect工作原理 微軟官方

我們生活在乙個模擬的世界 傳統程式設計基於一系列的規則 原因和結果,非黑即白,非真即假。在為輸入輸出數目有限的簡單系統建模時,這種方式工作得挺好。拿遊戲 halo 來說 吧 按a鍵是讓士官長跳,前撥左搖桿讓他向前走,前撥右搖桿讓他向上看。不是a,就是b。可惜的是,我們生活的真實世界並不是如此數位化,...