SHARE
TWEET

Untitled

a guest Jun 15th, 2017 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
  2.         {
  3.             string connectionString = "server=127.0.0.1; database=biblioteka; user=zyrc; password=eloelo67";
  4.             MySqlConnection connection = new MySqlConnection(connectionString);
  5.             connection.Open();
  6.             try
  7.             {
  8.                 MySqlCommand cmd = connection.CreateCommand();
  9.                 cmd.CommandText = "SELECT * FROM ksiazka";
  10.                 MySqlDataAdapter adap = new MySqlDataAdapter(cmd);
  11.                 DataSet ds = new DataSet();
  12.                 adap.Fill(ds);
  13.                 dataGridView1.DataSource = ds.Tables[0].DefaultView;
  14.             }
  15.             catch (Exception)
  16.             {
  17.                 throw;
  18.             }
  19.             finally
  20.             {
  21.                 if (connection.State == ConnectionState.Open)
  22.                 {
  23.                     connection.Clone();
  24.                 }
  25.             }
  26.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top