public System.Data.DataTable GetTableByProc(string ProcName, CmdParameter[] parms) { MySqlParameter[] pas = CFunctions.ConvertToMySqlParameter(parms); DataTable dt = new DataTable(); using (MySqlConnection conn = new MySqlConnection(strConn)) { using (MySqlDataAdapter da = new MySqlDataAdapter(ProcName, conn)) { try { da.SelectCommand.CommandType = CommandType.StoredProcedure; if (pas != null) { da.SelectCommand.Parameters.AddRange(pas); } dt.TableName = ProcName; da.Fill(dt); da.SelectCommand.Parameters.Clear(); } catch (Exception ex) { CFunctions.HandleException(System.Reflection.MethodBase.GetCurrentMethod().Name + ":" + ProcName, ex); throw (ex); } } } return(dt); }
public System.Data.DataTable GetTableByProc(string ProcName, ref CmdParameter[] parms) { MySqlParameter[] pas = CFunctions.ConvertToMySqlParameter(parms); DataTable dt = new DataTable(); using (MySqlConnection conn = new MySqlConnection(strConn)) { using (MySqlDataAdapter da = new MySqlDataAdapter(ProcName, conn)) { try { da.SelectCommand.CommandType = CommandType.StoredProcedure; if (pas != null) { da.SelectCommand.Parameters.AddRange(pas); } dt.TableName = ProcName; da.Fill(dt); da.SelectCommand.Parameters.Clear(); } catch (Exception ex) { CFunctions.HandleException(System.Reflection.MethodBase.GetCurrentMethod().Name + ":" + ProcName, ex); throw (ex); } try { conn.Open(); MySqlCommand cmd = new MySqlCommand(); cmd.Connection = conn; cmd.CommandText = ProcName; cmd.CommandType = CommandType.StoredProcedure; foreach (MySqlParameter sp in pas) { cmd.Parameters.Add(sp); } cmd.ExecuteNonQuery(); for (int i = 0; i < pas.Length; i++) { pas[i] = cmd.Parameters[i]; } parms = CFunctions.RecoverParameter(pas); } catch (Exception ex) { CFunctions.HandleException(System.Reflection.MethodBase.GetCurrentMethod().Name, ex); // throw (ex); } } } return(dt); }
public int ExcuteProc(string ProcName, CmdParameter[] parms) { MySqlParameter[] pas = CFunctions.ConvertToMySqlParameter(parms); return(ExcuteSQL(ProcName, pas, CommandType.StoredProcedure)); }