Пример #1
0
        public bool exportCSVmwawm(string path)
        {
            var       dtRandom  = new PemiraDBDataSet.DPTDataTable();
            bool      isSuccess = true;
            DataTable dtExport  = new DataTable();

            try
            {
                dptTableAdapter.FillRandomMWAWM(dtRandom);
                DataView dv = new DataView(dtRandom);
                //DATA LENGKAP:
                //dtExport = dv.ToTable(false, "nim", "nama", "nomorPilihanMWAWM");
                //DATA HANYA PILIHAN:
                dtExport = dv.ToTable(false, "nomorPilihanMWAWM");
                try
                {
                    WriteToFile(dtExport, path, false, ",");
                    MessageBox.Show("Export MWAWM results Successful");//\nNumber of rows: " + dtExport.Rows.Count);
                    isSuccess = true;
                }
                catch (Exception e)
                {
                    MessageBox.Show("Export Error\nMesage: " + e.Message + "\n\nSource: " + e.Source);
                    isSuccess = false;
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("Query Error" + "\n\nSource: " + e.Source);
            }

            dptTableAdapter.Fill(dt);
            return(isSuccess);
        }
Пример #2
0
        public bool exportCSVdp(string path)
        {
            var       dtRaw     = new PemiraDBDataSet.DPTDataTable();
            bool      isSuccess = true;
            DataTable dtExport  = new DataTable();

            try
            {
                dptTableAdapter.Fill(dtRaw);
                DataView dv = new DataView(dtRaw);
                dtExport = dv.ToTable(false, "nama", "nim", "sudahPilih");
                try
                {
                    WriteToFile(dtExport, path, false, ",");
                    isSuccess = true;
                }
                catch (Exception e)
                {
                    MessageBox.Show("Export Error\nMesage: " + e.Message + "\n\nSource: " + e.Source);
                    isSuccess = false;
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("Query Error\nMesage: " + e.Message + "\n\nSource: " + e.Source);
            }

            dptTableAdapter.Fill(dt);
            return(isSuccess);
        }