Esempio n. 1
0
        private void OkBtn_Click(object sender, EventArgs e)
        {
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Filter = "Excel文件(*.xls)|*.xls|所有文件(*.*)|*.*";
            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                DataTable dt = null;
                if (this.CompanyInfo.Checked == true)
                {
                    string strSql = "Select * From CompanyInfo";
                    dt = GetCompanyDataTable(strSql);
                }
                else if (this.HireHouseInfo.Checked == true)
                {
                    string strSql = "Select * From HireHouse";
                    dt = GetHireHouseDataTable(strSql);
                }
                else
                {
                }
                CSVFileHelper.SaveCSV(dt, dlg.FileName);
                this.Close();
            }
        }
Esempio n. 2
0
        private void exportBtn_Click(object sender, EventArgs e)
        {
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Filter = "Excel文件(*.xls)|*.xls|所有文件(*.*)|*.*";
            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                DataTable  dt     = null;
                ExportData export = new ExportData();
                string     strsql = "Select * ";
                strsql += this.strTempSql.Substring(this.strTempSql.IndexOf("From"));
                dt      = export.GetCompanyDataTable(strsql);
                if (dt != null)
                {
                    CSVFileHelper.SaveCSV(dt, dlg.FileName);
                    System.Diagnostics.Process.Start(dlg.FileName);
                }
            }
        }