예제 #1
0
 public bool RunProcedure(string ProcedureName, SqlParameter[] SqlParameters)
 {
     if (!Sql_DbObject.OpenConnection(this._SqlConnection))
     {
         return(false);
     }
     try
     {
         this._SqlCommand             = new SqlCommand();
         this._SqlCommand.Connection  = this._SqlConnection;
         this._SqlCommand.CommandType = CommandType.StoredProcedure;
         this._SqlCommand.CommandText = ProcedureName;
         for (int i = 0; i < SqlParameters.Length; i++)
         {
             SqlParameter value = SqlParameters[i];
             this._SqlCommand.Parameters.Add(value);
         }
         this._SqlCommand.ExecuteNonQuery();
     }
     catch (SqlException ex)
     {
         ApplicationLog.WriteError("ProcedureName: " + ProcedureName + "Message: " + ex.Message.Trim());
         return(false);
     }
     finally
     {
         this._SqlConnection.Close();
         this.Dispose(true);
     }
     return(true);
 }
예제 #2
0
 public bool RunProcedure(string ProcedureName)
 {
     if (!Sql_DbObject.OpenConnection(this._SqlConnection))
     {
         return(false);
     }
     try
     {
         this._SqlCommand             = new SqlCommand();
         this._SqlCommand.Connection  = this._SqlConnection;
         this._SqlCommand.CommandType = CommandType.StoredProcedure;
         this._SqlCommand.CommandText = ProcedureName;
         this._SqlCommand.ExecuteNonQuery();
     }
     catch (SqlException ex)
     {
         ApplicationLog.WriteError("Ö´Ðд洢¹ý³Ì: " + ProcedureName + "´íÎóÐÅϢΪ: " + ex.Message.Trim());
         return(false);
     }
     finally
     {
         this._SqlConnection.Close();
         this.Dispose(true);
     }
     return(true);
 }
예제 #3
0
        public DataTable GetDataTableBySqlcomm(string TableName, string Sqlcomm, int StartRecordNo, int PageSize)
        {
            DataTable dataTable = new DataTable(TableName);

            if (!Sql_DbObject.OpenConnection(this._SqlConnection))
            {
                dataTable.Dispose();
                this.Dispose(true);
                return(dataTable);
            }
            try
            {
                this._SqlCommand                   = new SqlCommand();
                this._SqlCommand.Connection        = this._SqlConnection;
                this._SqlCommand.CommandType       = CommandType.Text;
                this._SqlCommand.CommandText       = Sqlcomm;
                this._SqlDataAdapter               = new SqlDataAdapter();
                this._SqlDataAdapter.SelectCommand = this._SqlCommand;
                DataSet dataSet = new DataSet();
                dataSet.Tables.Add(dataTable);
                this._SqlDataAdapter.Fill(dataSet, StartRecordNo, PageSize, TableName);
            }
            catch (SqlException ex)
            {
                ApplicationLog.WriteError("Ö´ÐÐsqlÓï¾ä: " + Sqlcomm + "´íÎóÐÅϢΪ: " + ex.Message.Trim());
            }
            finally
            {
                this._SqlConnection.Close();
                this.Dispose(true);
            }
            return(dataTable);
        }
예제 #4
0
        public bool Exesqlcomm(string Sqlcomm)
        {
            bool result;

            if (!Sql_DbObject.OpenConnection(this._SqlConnection))
            {
                result = false;
            }
            else
            {
                try
                {
                    this._SqlCommand             = new SqlCommand();
                    this._SqlCommand.CommandType = CommandType.Text;
                    this._SqlCommand.Connection  = this._SqlConnection;
                    this._SqlCommand.CommandText = Sqlcomm;
                    this._SqlCommand.ExecuteNonQuery();
                }
                catch (SqlException ex)
                {
                    ApplicationLog.WriteError("执行sql语句: " + Sqlcomm + "错误信息为: " + ex.Message.Trim());
                    result = false;
                    return(result);
                }
                finally
                {
                    this._SqlConnection.Close();
                    this.Dispose(true);
                }
                result = true;
            }
            return(result);
        }
예제 #5
0
        public DataSet GetDataSetBySqlcomm(string TableName, string Sqlcomm)
        {
            DataSet dataSet = new DataSet();

            if (!Sql_DbObject.OpenConnection(this._SqlConnection))
            {
                return(dataSet);
            }
            try
            {
                this._SqlCommand                   = new SqlCommand();
                this._SqlCommand.Connection        = this._SqlConnection;
                this._SqlCommand.CommandType       = CommandType.Text;
                this._SqlCommand.CommandText       = Sqlcomm;
                this._SqlDataAdapter               = new SqlDataAdapter();
                this._SqlDataAdapter.SelectCommand = this._SqlCommand;
                this._SqlDataAdapter.Fill(dataSet);
            }
            catch (SqlException ex)
            {
                ApplicationLog.WriteError("Ö´ÐÐSqlÓï¾ä£º" + Sqlcomm + "´íÎóÐÅϢΪ£º" + ex.Message.Trim());
            }
            finally
            {
                this._SqlConnection.Close();
                this.Dispose(true);
            }
            return(dataSet);
        }
예제 #6
0
 public bool GetReader(ref SqlDataReader ResultDataReader, string ProcedureName, SqlParameter[] SqlParameters)
 {
     if (!Sql_DbObject.OpenConnection(this._SqlConnection))
     {
         return(false);
     }
     try
     {
         this._SqlCommand             = new SqlCommand();
         this._SqlCommand.Connection  = this._SqlConnection;
         this._SqlCommand.CommandType = CommandType.StoredProcedure;
         this._SqlCommand.CommandText = ProcedureName;
         for (int i = 0; i < SqlParameters.Length; i++)
         {
             SqlParameter value = SqlParameters[i];
             this._SqlCommand.Parameters.Add(value);
         }
         ResultDataReader = this._SqlCommand.ExecuteReader(CommandBehavior.CloseConnection);
     }
     catch (SqlException ex)
     {
         ApplicationLog.WriteError("Ö´Ðд洢¹ý³Ì: " + ProcedureName + "´íÎóÐÅϢΪ: " + ex.Message.Trim());
         return(false);
     }
     return(true);
 }
예제 #7
0
        public bool FillSqlDataReader(ref SqlDataReader Sdr, string SqlComm)
        {
            bool result;

            if (!Sql_DbObject.OpenConnection(this._SqlConnection))
            {
                result = false;
            }
            else
            {
                try
                {
                    this._SqlCommand             = new SqlCommand();
                    this._SqlCommand.Connection  = this._SqlConnection;
                    this._SqlCommand.CommandType = CommandType.Text;
                    this._SqlCommand.CommandText = SqlComm;
                    Sdr    = this._SqlCommand.ExecuteReader(CommandBehavior.CloseConnection);
                    result = true;
                    return(result);
                }
                catch (SqlException ex)
                {
                    ApplicationLog.WriteError("执行Sql语句:" + SqlComm + "错误信息为:" + ex.Message.Trim());
                }
                finally
                {
                    this.Dispose(true);
                }
                result = false;
            }
            return(result);
        }
예제 #8
0
 public bool FillSqlDataReader(ref SqlDataReader Sdr, string SqlComm)
 {
     if (!Sql_DbObject.OpenConnection(this._SqlConnection))
     {
         return(false);
     }
     try
     {
         this._SqlCommand             = new SqlCommand();
         this._SqlCommand.Connection  = this._SqlConnection;
         this._SqlCommand.CommandType = CommandType.Text;
         this._SqlCommand.CommandText = SqlComm;
         Sdr = this._SqlCommand.ExecuteReader(CommandBehavior.CloseConnection);
         return(true);
     }
     catch (SqlException ex)
     {
         ApplicationLog.WriteError("Ö´ÐÐSqlÓï¾ä£º" + SqlComm + "´íÎóÐÅϢΪ£º" + ex.Message.Trim());
     }
     finally
     {
         this.Dispose(true);
     }
     return(false);
 }
예제 #9
0
        public bool GetReader(ref SqlDataReader ResultDataReader, string ProcedureName, SqlParameter[] SqlParameters)
        {
            bool result;

            if (!Sql_DbObject.OpenConnection(this._SqlConnection))
            {
                result = false;
            }
            else
            {
                try
                {
                    this._SqlCommand             = new SqlCommand();
                    this._SqlCommand.Connection  = this._SqlConnection;
                    this._SqlCommand.CommandType = CommandType.StoredProcedure;
                    this._SqlCommand.CommandText = ProcedureName;
                    for (int i = 0; i < SqlParameters.Length; i++)
                    {
                        SqlParameter parameter = SqlParameters[i];
                        this._SqlCommand.Parameters.Add(parameter);
                    }
                    ResultDataReader = this._SqlCommand.ExecuteReader(CommandBehavior.CloseConnection);
                }
                catch (SqlException ex)
                {
                    ApplicationLog.WriteError("执行存储过程: " + ProcedureName + "错误信息为: " + ex.Message.Trim());
                    result = false;
                    return(result);
                }
                result = true;
            }
            return(result);
        }
예제 #10
0
 public bool Exesqlcomm(string Sqlcomm)
 {
     if (!Sql_DbObject.OpenConnection(this._SqlConnection))
     {
         return(false);
     }
     try
     {
         this._SqlCommand             = new SqlCommand();
         this._SqlCommand.CommandType = CommandType.Text;
         this._SqlCommand.Connection  = this._SqlConnection;
         this._SqlCommand.CommandText = Sqlcomm;
         this._SqlCommand.ExecuteNonQuery();
     }
     catch (SqlException ex)
     {
         ApplicationLog.WriteError("Ö´ÐÐsqlÓï¾ä: " + Sqlcomm + "´íÎóÐÅϢΪ: " + ex.Message.Trim());
         return(false);
     }
     finally
     {
         this._SqlConnection.Close();
         this.Dispose(true);
     }
     return(true);
 }
예제 #11
0
        public DataTable GetDataTable(string TableName, string ProcedureName)
        {
            DataTable dataTable = new DataTable(TableName);

            if (!Sql_DbObject.OpenConnection(this._SqlConnection))
            {
                dataTable.Dispose();
                this.Dispose(true);
                return(dataTable);
            }
            try
            {
                this._SqlCommand                   = new SqlCommand();
                this._SqlCommand.Connection        = this._SqlConnection;
                this._SqlCommand.CommandType       = CommandType.StoredProcedure;
                this._SqlCommand.CommandText       = ProcedureName;
                this._SqlDataAdapter               = new SqlDataAdapter();
                this._SqlDataAdapter.SelectCommand = this._SqlCommand;
                this._SqlDataAdapter.Fill(dataTable);
            }
            catch (SqlException ex)
            {
                ApplicationLog.WriteError("Ö´Ðд洢¹ý³Ì: " + ProcedureName + "´íÎóÐÅϢΪ: " + ex.Message.Trim());
            }
            finally
            {
                this._SqlConnection.Close();
                this.Dispose(true);
            }
            return(dataTable);
        }
예제 #12
0
 public bool GetDataTable(ref DataTable ResultTable, string TableName, string ProcedureName, int StartRecordNo, int PageSize)
 {
     ResultTable = null;
     if (!Sql_DbObject.OpenConnection(this._SqlConnection))
     {
         return(false);
     }
     try
     {
         this._SqlCommand                   = new SqlCommand();
         this._SqlCommand.Connection        = this._SqlConnection;
         this._SqlCommand.CommandType       = CommandType.StoredProcedure;
         this._SqlCommand.CommandText       = ProcedureName;
         this._SqlDataAdapter               = new SqlDataAdapter();
         this._SqlDataAdapter.SelectCommand = this._SqlCommand;
         DataSet dataSet = new DataSet();
         dataSet.Tables.Add(ResultTable);
         this._SqlDataAdapter.Fill(dataSet, StartRecordNo, PageSize, TableName);
         ResultTable = dataSet.Tables[TableName];
     }
     catch (SqlException ex)
     {
         ApplicationLog.WriteError("Ö´Ðд洢¹ý³Ì: " + ProcedureName + "´íÎóÐÅϢΪ: " + ex.Message.Trim());
         return(false);
     }
     finally
     {
         this._SqlConnection.Close();
         this.Dispose(true);
     }
     return(true);
 }
예제 #13
0
        public DataSet GetDateSet(string DatesetName, string ProcedureName, SqlParameter[] SqlParameters)
        {
            DataSet dataSet = new DataSet(DatesetName);

            if (!Sql_DbObject.OpenConnection(this._SqlConnection))
            {
                dataSet.Dispose();
                return(dataSet);
            }
            try
            {
                this._SqlCommand             = new SqlCommand();
                this._SqlCommand.Connection  = this._SqlConnection;
                this._SqlCommand.CommandType = CommandType.StoredProcedure;
                this._SqlCommand.CommandText = ProcedureName;
                for (int i = 0; i < SqlParameters.Length; i++)
                {
                    SqlParameter value = SqlParameters[i];
                    this._SqlCommand.Parameters.Add(value);
                }
                this._SqlDataAdapter = new SqlDataAdapter();
                this._SqlDataAdapter.SelectCommand = this._SqlCommand;
                this._SqlDataAdapter.Fill(dataSet);
            }
            catch (SqlException ex)
            {
                ApplicationLog.WriteError("Ö´Ðд洢¹ý³Ì£º" + ProcedureName + "´íÐÅÐÅϢΪ£º" + ex.Message.Trim());
            }
            finally
            {
                this._SqlConnection.Close();
                this.Dispose(true);
            }
            return(dataSet);
        }
예제 #14
0
 public void BeginRunProcedure(string ProcedureName, SqlParameter[] SqlParameters)
 {
     if (Sql_DbObject.OpenConnection(this._SqlConnection))
     {
         try
         {
             this._SqlCommand             = new SqlCommand();
             this._SqlCommand.Connection  = this._SqlConnection;
             this._SqlCommand.CommandType = CommandType.StoredProcedure;
             this._SqlCommand.CommandText = ProcedureName;
             for (int i = 0; i < SqlParameters.Length; i++)
             {
                 SqlParameter parameter = SqlParameters[i];
                 this._SqlCommand.Parameters.Add(parameter);
             }
             this._SqlCommand.BeginExecuteNonQuery();
         }
         catch (SqlException ex)
         {
             ApplicationLog.WriteError("执行存储过程: " + ProcedureName + "错误信息为: " + ex.Message.Trim());
         }
         finally
         {
             this._SqlConnection.Close();
             this.Dispose(true);
         }
     }
 }
예제 #15
0
        public bool RunProcedure(string ProcedureName)
        {
            bool result;

            if (!Sql_DbObject.OpenConnection(this._SqlConnection))
            {
                result = false;
            }
            else
            {
                try
                {
                    this._SqlCommand             = new SqlCommand();
                    this._SqlCommand.Connection  = this._SqlConnection;
                    this._SqlCommand.CommandType = CommandType.StoredProcedure;
                    this._SqlCommand.CommandText = ProcedureName;
                    this._SqlCommand.ExecuteNonQuery();
                }
                catch (SqlException ex)
                {
                    ApplicationLog.WriteError("执行存储过程: " + ProcedureName + "错误信息为: " + ex.Message.Trim());
                    result = false;
                    return(result);
                }
                finally
                {
                    this._SqlConnection.Close();
                    this.Dispose(true);
                }
                result = true;
            }
            return(result);
        }
예제 #16
0
        public DataSet GetDataSetBySqlcomm(string TableName, string Sqlcomm)
        {
            DataSet ResultTable = new DataSet();
            DataSet result;

            if (!Sql_DbObject.OpenConnection(this._SqlConnection))
            {
                result = ResultTable;
            }
            else
            {
                try
                {
                    this._SqlCommand                   = new SqlCommand();
                    this._SqlCommand.Connection        = this._SqlConnection;
                    this._SqlCommand.CommandType       = CommandType.Text;
                    this._SqlCommand.CommandText       = Sqlcomm;
                    this._SqlDataAdapter               = new SqlDataAdapter();
                    this._SqlDataAdapter.SelectCommand = this._SqlCommand;
                    this._SqlDataAdapter.Fill(ResultTable);
                }
                catch (SqlException ex)
                {
                    ApplicationLog.WriteError("执行Sql语句:" + Sqlcomm + "错误信息为:" + ex.Message.Trim());
                }
                finally
                {
                    this._SqlConnection.Close();
                    this.Dispose(true);
                }
                result = ResultTable;
            }
            return(result);
        }
예제 #17
0
        public static bool TryConnection()
        {
            bool result = false;

            try
            {
                Sql_DbObject temptank = new Sql_DbObject(AppConfig.AppSettings["conString"]);
                result = OpenConnection(temptank._SqlConnection);
                temptank.Dispose();
            }
            catch
            {
            }
            return(result);
        }
예제 #18
0
        public DataTable GetDataTable(string TableName, string ProcedureName, SqlParameter[] SqlParameters, int commandTimeout)
        {
            DataTable FullTable = new DataTable(TableName);
            DataTable result;

            if (!Sql_DbObject.OpenConnection(this._SqlConnection))
            {
                FullTable.Dispose();
                this.Dispose(true);
                result = FullTable;
            }
            else
            {
                try
                {
                    this._SqlCommand             = new SqlCommand();
                    this._SqlCommand.Connection  = this._SqlConnection;
                    this._SqlCommand.CommandType = CommandType.StoredProcedure;
                    this._SqlCommand.CommandText = ProcedureName;
                    if (commandTimeout >= 0)
                    {
                        this._SqlCommand.CommandTimeout = commandTimeout;
                    }
                    for (int i = 0; i < SqlParameters.Length; i++)
                    {
                        SqlParameter parameter = SqlParameters[i];
                        this._SqlCommand.Parameters.Add(parameter);
                    }
                    this._SqlDataAdapter = new SqlDataAdapter();
                    this._SqlDataAdapter.SelectCommand = this._SqlCommand;
                    this._SqlDataAdapter.Fill(FullTable);
                }
                catch (SqlException ex)
                {
                    ApplicationLog.WriteError("执行存储过程: " + ProcedureName + "错误信息为: " + ex.Message.Trim());
                }
                finally
                {
                    this._SqlConnection.Close();
                    this.Dispose(true);
                }
                result = FullTable;
            }
            return(result);
        }
예제 #19
0
        public bool GetDataTable(ref DataTable ResultTable, string TableName, string ProcedureName, int StartRecordNo, int PageSize, SqlParameter[] SqlParameters)
        {
            bool result;

            if (!Sql_DbObject.OpenConnection(this._SqlConnection))
            {
                result = false;
            }
            else
            {
                try
                {
                    this._SqlCommand             = new SqlCommand();
                    this._SqlCommand.Connection  = this._SqlConnection;
                    this._SqlCommand.CommandType = CommandType.StoredProcedure;
                    this._SqlCommand.CommandText = ProcedureName;
                    for (int i = 0; i < SqlParameters.Length; i++)
                    {
                        SqlParameter parameter = SqlParameters[i];
                        this._SqlCommand.Parameters.Add(parameter);
                    }
                    this._SqlDataAdapter = new SqlDataAdapter();
                    this._SqlDataAdapter.SelectCommand = this._SqlCommand;
                    DataSet ds = new DataSet();
                    ds.Tables.Add(ResultTable);
                    this._SqlDataAdapter.Fill(ds, StartRecordNo, PageSize, TableName);
                    ResultTable = ds.Tables[TableName];
                }
                catch (SqlException ex)
                {
                    ApplicationLog.WriteError("执行存储过程: " + ProcedureName + "错误信息为: " + ex.Message.Trim());
                    result = false;
                    return(result);
                }
                finally
                {
                    this._SqlConnection.Close();
                    this.Dispose(true);
                }
                result = true;
            }
            return(result);
        }
예제 #20
0
 public bool GetReader(ref SqlDataReader ResultDataReader, string ProcedureName)
 {
     if (!Sql_DbObject.OpenConnection(this._SqlConnection))
     {
         return(false);
     }
     try
     {
         this._SqlCommand             = new SqlCommand();
         this._SqlCommand.Connection  = this._SqlConnection;
         this._SqlCommand.CommandType = CommandType.StoredProcedure;
         this._SqlCommand.CommandText = ProcedureName;
         ResultDataReader             = this._SqlCommand.ExecuteReader(CommandBehavior.CloseConnection);
     }
     catch (SqlException ex)
     {
         ApplicationLog.WriteError("ProcedureName: " + ProcedureName + "Message: " + ex.Message.Trim());
         return(false);
     }
     return(true);
 }
예제 #21
0
        public DataTable GetDataTable(string TableName, string ProcedureName, SqlParameter[] SqlParameters, int commandTimeout)
        {
            DataTable dataTable = new DataTable(TableName);

            if (!Sql_DbObject.OpenConnection(this._SqlConnection))
            {
                dataTable.Dispose();
                this.Dispose(true);
                return(dataTable);
            }
            try
            {
                this._SqlCommand             = new SqlCommand();
                this._SqlCommand.Connection  = this._SqlConnection;
                this._SqlCommand.CommandType = CommandType.StoredProcedure;
                this._SqlCommand.CommandText = ProcedureName;
                if (commandTimeout >= 0)
                {
                    this._SqlCommand.CommandTimeout = commandTimeout;
                }
                for (int i = 0; i < SqlParameters.Length; i++)
                {
                    SqlParameter value = SqlParameters[i];
                    this._SqlCommand.Parameters.Add(value);
                }
                this._SqlDataAdapter = new SqlDataAdapter();
                this._SqlDataAdapter.SelectCommand = this._SqlCommand;
                this._SqlDataAdapter.Fill(dataTable);
            }
            catch (SqlException ex)
            {
                ApplicationLog.WriteError("Ö´Ðд洢¹ý³Ì: " + ProcedureName + "´íÎóÐÅϢΪ: " + ex.Message.Trim());
            }
            finally
            {
                this._SqlConnection.Close();
                this.Dispose(true);
            }
            return(dataTable);
        }
예제 #22
0
        public DataSet GetDateSet(string DatesetName, string ProcedureName, SqlParameter[] SqlParameters)
        {
            DataSet FullDataSet = new DataSet(DatesetName);
            DataSet result;

            if (!Sql_DbObject.OpenConnection(this._SqlConnection))
            {
                FullDataSet.Dispose();
                result = FullDataSet;
            }
            else
            {
                try
                {
                    this._SqlCommand             = new SqlCommand();
                    this._SqlCommand.Connection  = this._SqlConnection;
                    this._SqlCommand.CommandType = CommandType.StoredProcedure;
                    this._SqlCommand.CommandText = ProcedureName;
                    for (int i = 0; i < SqlParameters.Length; i++)
                    {
                        SqlParameter parameter = SqlParameters[i];
                        this._SqlCommand.Parameters.Add(parameter);
                    }
                    this._SqlDataAdapter = new SqlDataAdapter();
                    this._SqlDataAdapter.SelectCommand = this._SqlCommand;
                    this._SqlDataAdapter.Fill(FullDataSet);
                }
                catch (SqlException ex)
                {
                    ApplicationLog.WriteError("执行存储过程:" + ProcedureName + "错信信息为:" + ex.Message.Trim());
                }
                finally
                {
                    this._SqlConnection.Close();
                    this.Dispose(true);
                }
                result = FullDataSet;
            }
            return(result);
        }
예제 #23
0
        public bool RunProcedure(string ProcedureName, SqlParameter[] SqlParameters)
        {
            bool result;

            if (!Sql_DbObject.OpenConnection(this._SqlConnection))
            {
                LogProvider.Default.Debug("Open Failed");
                result = false;
            }
            else
            {
                try
                {
                    this._SqlCommand             = new SqlCommand();
                    this._SqlCommand.Connection  = this._SqlConnection;
                    this._SqlCommand.CommandType = CommandType.StoredProcedure;
                    this._SqlCommand.CommandText = ProcedureName;
                    for (int i = 0; i < SqlParameters.Length; i++)
                    {
                        SqlParameter parameter = SqlParameters[i];
                        this._SqlCommand.Parameters.Add(parameter);
                    }
                    this._SqlCommand.ExecuteNonQuery();
                }
                catch (SqlException ex)
                {
                    ApplicationLog.WriteError("执行存储过程: " + ProcedureName + "错误信息为: " + ex.Message.Trim());
                    result = false;
                    return(result);
                }
                finally
                {
                    this._SqlConnection.Close();
                    this.Dispose(true);
                }
                result = true;
            }
            return(result);
        }
예제 #24
0
        public DataTable GetDataTable(string TableName, string ProcedureName, int StartRecordNo, int PageSize)
        {
            DataTable RetTable = new DataTable(TableName);
            DataTable result;

            if (!Sql_DbObject.OpenConnection(this._SqlConnection))
            {
                RetTable.Dispose();
                this.Dispose(true);
                result = RetTable;
            }
            else
            {
                try
                {
                    this._SqlCommand                   = new SqlCommand();
                    this._SqlCommand.Connection        = this._SqlConnection;
                    this._SqlCommand.CommandType       = CommandType.StoredProcedure;
                    this._SqlCommand.CommandText       = ProcedureName;
                    this._SqlDataAdapter               = new SqlDataAdapter();
                    this._SqlDataAdapter.SelectCommand = this._SqlCommand;
                    DataSet ds = new DataSet();
                    ds.Tables.Add(RetTable);
                    this._SqlDataAdapter.Fill(ds, StartRecordNo, PageSize, TableName);
                }
                catch (SqlException ex)
                {
                    ApplicationLog.WriteError("执行存储过程: " + ProcedureName + "错误信息为: " + ex.Message.Trim());
                }
                finally
                {
                    this._SqlConnection.Close();
                    this.Dispose(true);
                }
                result = RetTable;
            }
            return(result);
        }
예제 #25
0
        public int GetRecordCount(string Sqlcomm)
        {
            int retval = 0;

            if (!Sql_DbObject.OpenConnection(this._SqlConnection))
            {
                retval = 0;
            }
            else
            {
                try
                {
                    this._SqlCommand             = new SqlCommand();
                    this._SqlCommand.Connection  = this._SqlConnection;
                    this._SqlCommand.CommandType = CommandType.Text;
                    this._SqlCommand.CommandText = Sqlcomm;
                    if (this._SqlCommand.ExecuteScalar() == null)
                    {
                        retval = 0;
                    }
                    else
                    {
                        retval = (int)this._SqlCommand.ExecuteScalar();
                    }
                }
                catch (SqlException ex)
                {
                    ApplicationLog.WriteError("执行sql语句: " + Sqlcomm + "错误信息为: " + ex.Message.Trim());
                }
                finally
                {
                    this._SqlConnection.Close();
                    this.Dispose(true);
                }
            }
            return(retval);
        }
예제 #26
0
 public bool GetDataSet(ref DataSet ResultDataSet, ref int row_total, string TableName, string ProcedureName, int StartRecordNo, int PageSize, SqlParameter[] SqlParameters)
 {
     if (!Sql_DbObject.OpenConnection(this._SqlConnection))
     {
         return(false);
     }
     try
     {
         row_total                    = 0;
         this._SqlCommand             = new SqlCommand();
         this._SqlCommand.Connection  = this._SqlConnection;
         this._SqlCommand.CommandType = CommandType.StoredProcedure;
         this._SqlCommand.CommandText = ProcedureName;
         for (int i = 0; i < SqlParameters.Length; i++)
         {
             SqlParameter value = SqlParameters[i];
             this._SqlCommand.Parameters.Add(value);
         }
         this._SqlDataAdapter = new SqlDataAdapter();
         this._SqlDataAdapter.SelectCommand = this._SqlCommand;
         DataSet dataSet = new DataSet();
         row_total = this._SqlDataAdapter.Fill(dataSet);
         this._SqlDataAdapter.Fill(ResultDataSet, StartRecordNo, PageSize, TableName);
     }
     catch (SqlException ex)
     {
         ApplicationLog.WriteError("Ö´Ðд洢¹ý³Ì£º" + ProcedureName + "´íÎóÐÅϢΪ£º" + ex.Message.Trim());
         return(false);
     }
     finally
     {
         this._SqlConnection.Close();
         this.Dispose(true);
     }
     return(true);
 }
예제 #27
0
 public BaseBussiness()
 {
     db = new Sql_DbObject("AppConfig", "conString");
 }
예제 #28
0
 public MemberShipBussiness()
 {
     db = new Sql_DbObject("AppConfig", "membershipDb");
 }