i download and used excellibrary in my coding. i need help in calling my function from database to excel.. i cannot hide certain columns such as id number for example.. hope you can help me out. and i also need help how to make multiple database go to into same excel.. tq very much.. below is my coding
public void load_table_exec()// this is use to load table automatically //illi female
{
string constring = "datasource=localhost; port=3306;username=root;password=";
MySqlConnection conDataBase = new MySqlConnection(constring);
MySqlCommand cmdDataBase = new MySqlCommand("select * from database1.example ; ", conDataBase); //
try
{
MySqlDataAdapter sda = new MySqlDataAdapter();
sda.SelectCommand = cmdDataBase;
DataTable dbdataset = new DataTable();
sda.Fill(dbdataset);
BindingSource bSource = new BindingSource();
bSource.DataSource = dbdataset;
dataGridView1.DataSource = bSource;
sda.Update(dbdataset);
DataSet ds = new DataSet("New_DataSet");
ds.Locale = System.Threading.Thread.CurrentThread.CurrentCulture;
sda.Fill(dbdataset);
ds.Tables.Add(dbdataset);
ExcelLibrary.DataSetHelper.CreateWorkbook("MyExcelFile.xls", ds);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
i did also try MySqlCommand cmdDataBase = new MySqlCommand("select name,age, ... from database1.example ; ", conDataBase); but the problem occurred when i wanted to delete user or update it since it need to be referred to id um.. need help.. tq