コード例 #1
0
ファイル: SQLViewForm.cs プロジェクト: eksotama/FBXpert
        private void RunSQLFromFile()
        {
            progressBar1.Value = progressBar1.Minimum;
            UserActionClass.Instance().UserAction = UserActionType.none;
            if (!string.IsNullOrEmpty(SQLViewLastRunClass.Instance().ScriptPath))
            {
                ofdSQL.InitialDirectory = SQLViewLastRunClass.Instance().ScriptPath;
            }
            if (ofdSQL.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            hsRunSQLfromFile.Enabled = false;

            dataSet1.Clear();
            dgvResults.AutoGenerateColumns = true;
            var fi = new FileInfo(ofdSQL.FileName);

            progressBar1.Value   = 0;
            progressBar1.Maximum = (int)fi.Length;
            hsBreak.Enabled      = true;
            string connectionstr = ConnectionStrings.Instance().MakeConnectionString(_dbReg);

            string[] strarr = File.ReadAllLines(fi.FullName);
            var      sb     = new StringBuilder();

            var ri = _sqLcommand.ExecuteCommandsAddToDataset(dataSet1, strarr, true);

            dataSet1 = ri.dataSet;

            hsRunSQLfromFile.Enabled = true;
            SQLViewLastRunClass.Instance().ScriptPath = fi.Directory.FullName;
            UserBreak();
        }
コード例 #2
0
ファイル: SQLViewForm.cs プロジェクト: eksotama/FBXpert
        private void LoadConfig()
        {
            var pf = SQLViewLastRunClass.Instance();

            secDATABASEPATH.Inhalt = pf.ServerDatabasePfad;
            secSERVERNAME.Inhalt   = pf.ServerName;
        }
コード例 #3
0
ファイル: SQLViewForm.cs プロジェクト: eksotama/FBXpert
        private void LoadSQL()
        {
            if (SQLViewLastRunClass.Instance().ScriptPath != null)
            {
                if (SQLViewLastRunClass.Instance().ScriptPath.Length > 0)
                {
                    ofdSQL.InitialDirectory = SQLViewLastRunClass.Instance().ScriptPath;
                }
            }
            if (ofdSQL.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            txtSQL.Clear();
            var fi = new FileInfo(ofdSQL.FileName);

            using (System.IO.StreamReader file = new StreamReader(fi.FullName, Encoding.UTF8))
            {
                SQLViewLastRunClass.Instance().ScriptPath = fi.Directory.FullName;
                var    sql  = new StringBuilder();
                string line = string.Empty;
                while ((line = file.ReadLine()) != null)
                {
                    txtSQL.AppendText(line + Environment.NewLine);
                }
                file.Close();
            }
        }