Example #1
0
		private void EhViewResults()
		{
			try
			{
				// get the data
				var da = new System.Data.OleDb.OleDbDataAdapter(SelectionStatement, ConnectionString.ConnectionStringWithTemporaryCredentials);
				var dt = new System.Data.DataTable("Query");
				da.Fill(dt);

				// show the data
				using (var dlg = new DataPreviewController(dt))
				{
					Current.Gui.ShowDialog(dlg, "Preview data", false);
				}
			}
			catch (Exception x)
			{
				var msg = string.Format("Failed to retrieve data:\r\n{0}", x.Message);
				Current.Gui.ErrorMessageBox(msg, "Warning");
			}
		}
		private void EhViewResults()
		{
			// make sure we have a select statement
			var sql = _selectionStatement;
			if (string.IsNullOrEmpty(sql))
			{
				return;
			}

			// create table to load with data and display
			var dt = new System.Data.DataTable("Query");

			// get data
			try
			{
				using (var da = new System.Data.OleDb.OleDbDataAdapter(SelectionStatement, ConnectionString.ConnectionStringWithTemporaryCredentials))
				{
					// get data
					da.Fill(0, MAX_PREVIEW_RECORDS, dt);

					// show the data
					var ctrl = new DataPreviewController(dt);
					string title = string.Format("{0} ({1:n0} records)", dt.TableName, dt.Rows.Count);
					Current.Gui.ShowDialog(ctrl, title, false);
				}
			}
			catch (Exception x)
			{
				Current.Gui.ErrorMessageBox(string.Format("Failed to retrieve data:\r\n{0}", x.Message));
			}
		}
		private void EhViewResults()
		{
			// make sure we have a select statement
			var sql = _selectionStatement;
			if (string.IsNullOrEmpty(sql))
			{
				return;
			}

			// create table to load with data and display
			var dt = new System.Data.DataTable("Query");

			// get table/view name
			var selNode = _treeRootNode.AnyBetweenHereAndLeaves(x => x.IsSelected);
			var table = selNode == null ? null : selNode.Tag as System.Data.DataTable;
			dt.TableName = table.TableName;

			// get view parameters if necessary
			var parms = OleDbSchema.GetTableParameters(table);
			if (parms != null && parms.Count > 0)
			{
				var ctrl = new ParametersController(parms);
				if (!Current.Gui.ShowDialog(ctrl, "Parameter", false))
				{
					return;
				}
			}

			// get data
			try
			{
				using (var da = new System.Data.OleDb.OleDbDataAdapter(_selectionStatement, ConnectionString.ConnectionStringWithTemporaryCredentials))
				{
					// get data
					da.Fill(0, MAX_PREVIEW_RECORDS, dt);

					// show the data
					var ctrl = new DataPreviewController(dt);
					string title = string.Format("{0} ({1:n0} records)", dt.TableName, dt.Rows.Count);
					Current.Gui.ShowDialog(ctrl, title, false);
				}
			}
			catch (Exception x)
			{
				Current.Gui.ErrorMessageBox(string.Format("Failed to retrieve data:\r\n{0}", x.Message));
			}
		}