コード例 #1
0
ファイル: General.cs プロジェクト: pasha494/MAPInventory
 public DataSet SetWithDataSet(ArrayList param, string SPName, out long ReturnValue, int CompanyIndex = 0)
 {
     ReturnValue = 0L;
     try
     {
         if (General.DataBase.Equals("SQL"))
         {
             SQLDBResult dbResult = SQLAdapter.Execute(SPName, param, SQLAdapter.GetConnection(CompanyIndex));
             ReturnValue = Convert.ToInt64(dbResult.Parameters[(object)"@RETURN_VALUE"]);
             this.LogException(param, SPName, CompanyIndex, dbResult, "", ReturnValue);
             return(dbResult.Contents);
         }
     }
     catch (Exception ex)
     {
         this.LogException(param, SPName, CompanyIndex, (SQLDBResult)null, ex.Message, ReturnValue);
     }
     return(new DataSet());
 }
コード例 #2
0
        public static SQLDBResult Execute(string procedureName, ArrayList procedureParameters, string strConnection)
        {
            SQLDBResult   sqldbResult = (SQLDBResult)null;
            SqlConnection connection  = (SqlConnection)null;

            try
            {
                connection = new SqlConnection(strConnection);
                connection.Open();
                SqlCommand selectCommand = SQLAdapter.Procedure(connection, procedureName, (SqlTransaction)null).Command(connection, procedureParameters);
                selectCommand.CommandTimeout = 0;
                sqldbResult = new SQLDBResult();
                new SqlDataAdapter(selectCommand).Fill(sqldbResult.Contents);
                foreach (SqlParameter sqlParameter in (DbParameterCollection)selectCommand.Parameters)
                {
                    switch (sqlParameter.Direction)
                    {
                    case ParameterDirection.Output:
                    case ParameterDirection.InputOutput:
                    case ParameterDirection.ReturnValue:
                        sqldbResult.Parameters[(object)sqlParameter.ParameterName] = sqlParameter.Value;
                        continue;

                    default:
                        continue;
                    }
                }
            }
            catch (Exception ex)
            {
                throw new SQLAdapter.DbUtilException(ex.Message, ex);
            }
            finally
            {
                if (connection != null && connection.State == ConnectionState.Open)
                {
                    connection.Close();
                }
            }
            return(sqldbResult);
        }
コード例 #3
0
ファイル: General.cs プロジェクト: pasha494/MAPInventory
        public DataSet Get(ArrayList param, string SPName, int CompanyIndex = 0)
        {
            DataSet dataSet     = new DataSet();
            long    ReturnValue = 0L;

            try
            {
                if (General.DataBase.Equals("SQL"))
                {
                    SQLDBResult dbResult = SQLAdapter.Execute(SPName, param, SQLAdapter.GetConnection(CompanyIndex));
                    dataSet     = dbResult.Contents;
                    ReturnValue = Convert.ToInt64(dbResult.Parameters[(object)"@RETURN_VALUE"]);
                    //if (SPName == "sp_GetUserDetails")
                    //    throw new Exception();
                    this.LogException(param, SPName, CompanyIndex, dbResult, "", ReturnValue);
                }
            }
            catch (Exception ex)
            {
                this.LogException(param, SPName, CompanyIndex, (SQLDBResult)null, ex, ReturnValue);
            }
            return(dataSet);
        }
コード例 #4
0
ファイル: General.cs プロジェクト: pasha494/MAPInventory
 public bool IsDatabaseExists()
 {
     try
     {
         SQLAdapter.Execute(" if exists(select name from sys.databases where name='pact2c') RAISERROR('-100',16,1) ", SQLAdapter.GetConnection());
         return(false);
     }
     catch (Exception ex)
     {
         return(true);
     }
 }
コード例 #5
0
ファイル: General.cs プロジェクト: pasha494/MAPInventory
 public int ExecuteScript(string Query, int CompanyIndex = 0)
 {
     return(SQLAdapter.Execute(Query, SQLAdapter.GetConnection(CompanyIndex)));
 }