分享乙個拿即用的oraclehelper
首先要引用本機中的oralce access,如果是64位的話,也必須是64位執行,不然會報連線為空connection 等於null.
using oracle.dataaccess;using oracle.dataaccess.client;
public class orahelper/// /// 獲取預設的連線
///
///
public static oracleconnection getconnection()
/// /// 建立新的連線(用於事務操作)
///
///
public static oracleconnection createconnection()
public static bool connectiontest()
catch
finally
return ret;
}public static int executenonquery(commandtype cmdtype, string cmdtext, params oracleparameter commandparameters)
catch
finally
return val;
}public static int executenonquery(string cmdtext)
public static int executenonquery(string cmdtext, params oracleparameter commandparameters)
/// /// 以事務的方式執行(多用於多條sql語句執行)
///
public static int executenonquerybytransaction(string cmdtext, params oracleparameter commandparameters)
catch
finally
return val;
}public static int executenonquery(oracletransaction trans, commandtype cmdtype, string cmdtext, params oracleparameter commandparameters)
catch
finally
return val;
}public static oracledatareader executereader(commandtype cmdtype, string cmdtext, params oracleparameter commandparameters)
catch
finally
return rdr;
}public static datatable executedatatable(string cmdtext)
catch
finally
return dt;
}public static datatable executedatatable(string cmdtext, params oracleparameter commandparameters)
catch
finally
return dt;
}public static datatable executedatatable(commandtype cmdtype, string cmdtext, params oracleparameter commandparameters)
catch
finally
return dt;
}public static dataset executedataset(string cmdtext)
catch
finally
if (ds == null || ds.tables.count == 0 || ds.tables[0].rows.count == 0) return null;
else return ds;
}public static dataset executedataset(string cmdtext, params oracleparameter commandparameters)
catch
finally
if (ds == null || ds.tables.count == 0 || ds.tables[0].rows.count == 0) return null;
else return ds;
}public static dataset executedataset(commandtype cmdtype, string cmdtext, params oracleparameter commandparameters)
catch
finally
if (ds == null || ds.tables.count == 0 || ds.tables[0].rows.count == 0) return null;
else return ds;
}public static object executescalar(string cmdtext)
public static object executescalar(string cmdtext, params oracleparameter commandparameters)
public static object executescalar(commandtype cmdtype, string cmdtext, params oracleparameter commandparameters)
catch
finally
return val;
}private static void preparecommand(oraclecommand cmd, oracletransaction trans, commandtype cmdtype, string cmdtext, params oracleparameter cmdparms)
else
cmd.commandtext = cmdtext;
cmd.commandtype = cmdtype;
if (cmdparms != null)}}
"v4.0
" sku="
.netframework,version=v4.5.2
" />
connetionstring
" value="
data source=192.168.0.2/orcl;user id=test;password=123456;persist security info=false;pooling=false
"/>
分享乙個SharedPreferences工具類
直接上 public class sputils else if object instanceof integer else if object instanceof boolean else if object instanceof float else if object instanceof...
分享乙個下雪特效
前言 二 步驟 總結晚到的聖誕禮物 聖誕下雪特效 如下 示例 canvas canvas maincontainer title 聖誕節快樂!h1 div 如下 示例 body h1 maincontainer title style var c document.getelementbyid ca...
分享乙個500異常
這是個spring相關的專案,很顯然錯誤資訊中沒有什麼有效的資訊。報錯500說明服務端那邊有問題,於是博主在服務端打了個斷點,單步執行,發現程式都沒進入斷點!最後 xmlns xmlns xsi xmlns mvc xmlns context xsi schemalocation spring mv...