public void RunProcedure_one(string sProcName, string ddate) { try { MyDbHelper DbHelper = new MyDbHelper(MyDbHelper.connectstring_cardqs); OleDbParameter[] sqlparam = new OleDbParameter[2]; sqlparam[0] = MyDbHelper.MakeInParam("ddate", OleDbType.Char, 8, ddate); sqlparam[1] = MyDbHelper.MakeOutParam("ret", OleDbType.Char, 200, null); DbHelper.ExecuteNonQuery(sProcName.Trim(), sqlparam, true); } catch (Exception ex) { MyLog.Log("3", "执行单日期" + sProcName + "存储过程流程时发生异常:" + ex.Message); } finally { if (DbHelper != null) { DbHelper.Dispose();//新加的 } } }
public void RunProcedure(string sProcName, string beginDate, string endDate, string constr) { try { MyDbHelper DbHelper = new MyDbHelper(constr); OleDbParameter[] sqlparam = new OleDbParameter[3]; sqlparam[0] = MyDbHelper.MakeInParam("date1", OleDbType.Char, 8, beginDate); sqlparam[1] = MyDbHelper.MakeInParam("date2", OleDbType.Char, 8, endDate); sqlparam[2] = MyDbHelper.MakeOutParam("ret", OleDbType.Char, 200, null); DbHelper.ExecuteNonQuery(sProcName.Trim(), sqlparam, true); } catch (Exception ex) { MyLog.Log("3", "执行双日期" + sProcName + "存储过程流程时发生异常:" + ex.Message); } finally { if (DbHelper != null) { DbHelper.Dispose();//新加的 } } }