Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using ExcelLibrary.CompoundDocumentFormat;
- using ExcelLibrary.SpreadSheet;
- using ExcelLibrary.BinaryDrawingFormat;
- using ExcelLibrary.BinaryFileFormat;
- string myConnection = "datasource=root;port=root;username=root;password=root";
- MySqlConnection myConn = new MySqlConnection(myConnection);
- MySqlCommand cmdDataBase = new MySqlCommand("select name,surname,birth,telephone,email,city,adress,recorddate from doguAkdenizApp.team;", myConn);
- try
- {
- MySqlDataAdapter dataAdapter = new MySqlDataAdapter();
- dataAdapter.SelectCommand = cmdDataBase;
- dbdataset = new DataTable();
- dataAdapter.Fill(dbdataset);
- BindingSource bSource = new BindingSource();
- bSource.DataSource = dbdataset;
- dgvEkip.DataSource = bSource;
- dataAdapter.Update(dbdataset);
- DataSet dataSet = new DataSet("ekipDataset");
- dataSet.Locale = System.Threading.Thread.CurrentThread.CurrentCulture;
- dataAdapter.Fill(dbdataset);
- dataSet.Tables.Add(dbdataset);
- ExcelLibrary.DataSetHelper.CreateWorkbook("ekipDataset.xls", dataSet);
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- string myConnection = "datasource=root;port=root;username=root;password=root";
- MySqlConnection myConn = new MySqlConnection(myConnection);
- MySqlCommand cmdDataBase = new MySqlCommand("select name,surname,birth,telephone,email,city,adress,recorddate from doguAkdenizApp.team;", myConn);
- MySqlDataAdapter dataAdapter = new MySqlDataAdapter();
- dataAdapter.SelectCommand = cmdDataBase;
- dbdataset = new DataTable();
- dataAdapter.Fill(dbdataset);
- BindingSource bSource = new BindingSource();
- bSource.DataSource = dbdataset;
- dgvEkip.DataSource = bSource;
- dataAdapter.Update(dbdataset);
- dbdataset.WriteXml("Ekip_Dataset.xls"); //I am not sure why he used "WriteXml" but i tried as this
- MessageBox.Show("Dosya basariyla olusturulmustur.");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement