Пример #1
0
 private void GetData(string selectCommand)
 {
     try
     {
         // Create a new data adapter based on the specified query.
         RegiondataAdapter = new MySqlDataAdapter(selectCommand, Util.Connection);
         // Create a command builder to generate SQL update, insert, and
         // delete commands based on selectCommand. These are used to
         // update the database.
         commandBuilder = new MySqlCommandBuilder(RegiondataAdapter);
         RegionDatatable.Clear();
         // Populate a new data table and bind it to the BindingSource.
         RegionDatatable.Locale = System.Globalization.CultureInfo.InvariantCulture;
         RegiondataAdapter.Fill(RegionDatatable);
         RegionbindingSource.DataSource = RegionDatatable;
     }
     catch (MySqlException ex)
     {
         MessageBox.Show("Error " + ex.Message);
     }
 }