public DTReturnClass ExecProcRSParams(string procname, SP_Parameters p) { DTReturnClass outcome = new DTReturnClass(true); DataTable dt = new DataTable(); SqlCommand cmd = null; SqlDataAdapter da = null; try{ if (conn.State != ConnectionState.Open) { conn.Open(); } cmd = new SqlCommand(); if (commandtimeout > 0) { cmd.CommandTimeout = commandtimeout; } cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = procname; cmd.Connection = conn; if (p != null) { foreach (SqlParameter objparam1 in p) { cmd.Parameters.Add(objparam1); } } da = new SqlDataAdapter(cmd); da.Fill(dt); da.Dispose(); if (conn.State != ConnectionState.Closed) { conn.Close(); } outcome.Datatable = dt; } catch (Exception ex) { outcome.Success = false; outcome.Message = "An query Failed. Please see logs for exact error"; outcome.Techmessage = "ExecProcRSParams error. Procedure is[" + procname + "] Error:[" + ex.ToString() + "]"; } finally { if (cmd != null) { cmd.Dispose(); } if (conn.State != ConnectionState.Closed) { conn.Close(); } } return(outcome); }
public void SetProps(DTReturnClass ret) { mSuccess = ret.Success; mMessage = ret.Message; mTechmessage = ret.Techmessage; }