private DataSet FillDataSet()
        {
            try {
                if (this.connection.State == ConnectionState.Closed)
                {
                    this.connection.Open();
                }

                IDbCommand command = this.connection.CreateCommand();
                command.CommandText = reportSettings.CommandText;
                command.CommandType = reportSettings.CommandType;
                // We have to check if there are parameters for this Query, if so
                // add them to the command

                BuildQueryParameters(command, reportSettings.ParameterCollection);

                IDbDataAdapter adapter = connectionObject.CreateDataAdapter(command);
                DataSet        ds      = new DataSet();
                ds.Locale = CultureInfo.CurrentCulture;
                adapter.Fill(ds);
                return(ds);
            } finally {
                if (this.connection.State == ConnectionState.Open)
                {
                    this.connection.Close();
                }
            }
        }
Beispiel #2
0
        public DataSet ReadData()
        {
            try {
                if (this.connectionObject.Connection.State == ConnectionState.Closed)
                {
                    this.connectionObject.Connection.Open();
                }

                IDbCommand command = this.connectionObject.Connection.CreateCommand();

                if (String.IsNullOrEmpty(this.connectionObject.QueryString))
                {
                    command.CommandText = reportSettings.CommandText;
                }
                else
                {
                    command.CommandText = this.connectionObject.QueryString;
                }



                command.CommandType = reportSettings.CommandType;


                BuildQueryParameters(command, reportSettings.ParameterCollection);

                IDbDataAdapter adapter = connectionObject.CreateDataAdapter(command);
                DataSet        ds      = new DataSet();
                ds.Locale = CultureInfo.CurrentCulture;
                adapter.Fill(ds);
                return(ds);
            } finally {
                if (this.connectionObject.Connection.State == ConnectionState.Open)
                {
                    this.connectionObject.Connection.Close();
                }
            }
        }