Beispiel #1
0
        private void TabOpenFile()
        {
            Stream         stream;
            OpenFileDialog dlg = new OpenFileDialog()
            {
                Filter           = "SQL files (*.sql)|*.sql|All files (*)|*",
                FilterIndex      = 1,
                RestoreDirectory = true
            };

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                if ((stream = dlg.OpenFile()) != null)
                {
                    string fileName = dlg.FileName;
                    try
                    {
                        string buffer = File.ReadAllText(fileName);
                        ActiveSqlSession.Editor.Text = buffer;
                        ActiveSqlSession.InitDatabase(ActiveSessionProviderDetails);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("An issue occurred attempting to open file.\n\r" + ex.Message);
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>Execute based upon currently selected database path</summary>
        private void ExecuteQuery()
        {
            // 1. Ensure we're executing against selected DB from dropdown
            ActiveSqlSession.InitDatabase(ActiveSessionProviderDetails);

            // 2. Execute
            //TODO: ExecuteQuery via Thread-safe operation
            ActiveSqlSession.Execute();

            // 3. Ensure we're returning feedback via EventHandler
        }