DataAccess.ClientDataAccess.RunProc C# (CSharp) Method

RunProc() public static method

public static RunProc ( string strConnect, string procName ) : void
strConnect string
procName string
return void
        public static void RunProc(string strConnect, string procName)
        {
            //****************************************
            //* Purpose: Executing Stored Procedures where UPDATE, INSERT
            //*and DELETE statements are expected but does not
            //*work for select statement is expected.
            //* Input parameters:
            //*procName ---StoredProcedures name
            //* Returns :
            //*nothing
            //* ***************************************
            string strCommandText = procName;
            //create a new Connection object using the connection string
            var objConnect = new SqlConnection(strConnect);
            //create a new Command using the CommandText and Connection object
            var objCommand = new SqlCommand(strCommandText, objConnect) {CommandTimeout = 3600};
            //set the timeout in seconds

            try
            {
                objConnect.Open();
                objCommand.ExecuteNonQuery();
            }
            catch (Exception objError)
            {
                //write error to the windows event log
                Errhandle.StopProcessing(objError, strCommandText);

                // Console.WriteLine(objError.Message.ToString());
                //Console.WriteLine("Query -----------\r\n" + strCommandText);
                throw;
            }
            finally
            {
                    objConnect.Close();
                    objConnect.Dispose();
            }
        }
ClientDataAccess