예제 #1
0
        private void btnPreview_Click(object sender, EventArgs e)
        {
            try
            {
                string connStr = string.Empty;
                if (cmbAuthentication.Text == "Windows Authentication")
                {
                    connStr = ConnectionString.SQL_Windows(cmbServer.Text, cmbDatabase.Text);
                }
                else
                {
                    connStr = ConnectionString.SQL_Server(cmbServer.Text, cmbDatabase.Text, txtUsername.Text, txtPassword.Text);
                }

                DataSet ds = Data.SQL.TestQuery(connStr, txtQuery.Text);
                if (ds.IsEmpty() == false)
                {
                    DataPreview dp = new DataPreview(ds);
                    dp.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                ex.Write();
            }
        }
예제 #2
0
        private void btnPreview_Click(object sender, EventArgs e)
        {
            try
            {
                string userEmail = ShowDialog("Please enter the e-mail of a user to preview.", "CGoogleDrive");
                if (string.IsNullOrEmpty(userEmail))
                {
                    MessageBox.Show("You must enter an e-mail address to preview!", "CGoogleDrive");
                    return;
                }

                GoogleAccess ga = new GoogleAccess();
                DataSet      ds = ga.Preview(settings, userEmail).ToDataSet();
                List <KeyValuePair <string, string> > columns = new List <KeyValuePair <string, string> >();
                columns.Add(new KeyValuePair <string, string>("Id", "Id"));
                columns.Add(new KeyValuePair <string, string>("MimeType", "MimeType"));
                columns.Add(new KeyValuePair <string, string>("Name", "Name"));
                columns.Add(new KeyValuePair <string, string>("Size", "Size"));
                columns.Add(new KeyValuePair <string, string>("WebViewLink", "WebViewLink"));
                DataPreview dp = new DataPreview(ds, columns);
                dp.ShowDialog();
            }
            catch (Exception ex)
            {
                ex.Write();
            }
        }
예제 #3
0
        private void btnPreview_Click(object sender, EventArgs e)
        {
            try
            {
                string connStr = string.Empty;
                if (txtUsername.Text != string.Empty || txtPassword.Text != string.Empty)
                {
                    connStr = ConnectionString.MongoDB(txtServer.Text, txtUsername.Text, txtPassword.Text);
                }
                else
                {
                    connStr = ConnectionString.MongoDB(txtServer.Text);
                }
                DataSet ds = Data.Mongo_DB.GetData(connStr, cmbDatabase.Text, cmbCollection.Text);

                if (ds.IsEmpty() == false)
                {
                    DataPreview dp = new DataPreview(ds);
                    dp.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                ex.Write();
            }
        }
예제 #4
0
 private void btnPreview_Click(object sender, EventArgs e)
 {
     try
     {
         if (!string.IsNullOrEmpty(txtQuery.Text))
         {
             DataSet ds = Data.MySQL.GetData(connStr, txtQuery.Text);
             if (ds.IsEmpty() == false)
             {
                 DataPreview dp = new DataPreview(ds);
                 dp.ShowDialog();
             }
         }
     }
     catch (Exception ex)
     {
         ex.Write();
     }
 }
예제 #5
0
        private void btnPreview_Click(object sender, EventArgs e)
        {
            try
            {
                StreamReader sr = new StreamReader(txtPath.Text);
                DataTable    dt = sr.ConvertCSVtoDataTable();

                if (dt.IsEmpty() == false)
                {
                    DataSet ds = new DataSet();
                    ds.Tables.Add(dt);
                    DataPreview dp = new DataPreview(ds);
                    dp.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                ex.Write();
            }
        }