Ejemplo n.º 1
0
		private DataSet FillGrid() 
		{
			SqlQueryChecker.Check(model.ReportSettings.CommandType,
			                      model.ReportSettings.CommandText);
			
			DataSet dataSet = ResultPanel.CreateDataSet ();
			
			this.txtSqlString.Text = model.ReportSettings.CommandText;
			switch (model.ReportSettings.CommandType) {
				case CommandType.Text:
						this.connectionObject = CreateConnection ();
						var dataAccess = new SqlDataAccessStrategy(model.ReportSettings,connectionObject);
						dataSet = dataAccess.ReadData();
						dataSet.Tables[0].TableName = CreateTableName (reportStructure);
					break;
				case CommandType.StoredProcedure:
					dataSet = DatasetFromStoredProcedure();
					break;
				case CommandType.TableDirect:
					MessageService.ShowError("TableDirect is not suppurted at the moment");
					break;
				default:
					throw new Exception("Invalid value for CommandType");
			}
			return dataSet;
		}
Ejemplo n.º 2
0
		DataSet DatasetFromStoredProcedure()
		{
			this.connectionObject = CreateConnection();
			DataSet dataSet = ResultPanel.CreateDataSet();
			IProcedure procedure = reportStructure.IDatabaseObjectBase as IProcedure;
			
			var paramCollection = CheckParameters(procedure);
			
			
			if (paramCollection.Count > 0) {
				FillParameters(paramCollection);
				reportStructure.SqlQueryParameters.AddRange(paramCollection);
			}
			
			var dataAccess = new SqlDataAccessStrategy(model.ReportSettings,connectionObject);
			dataSet = dataAccess.ReadData();
			dataSet.Tables[0].TableName = procedure.Name;
			
			return dataSet;
		}