SHARE
TWEET

Untitled

a guest Jun 15th, 2017 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using MySql.Data.MySqlClient;
  11.  
  12. namespace AplikacjaIO
  13. {
  14.     public partial class Form2 : Form
  15.     {
  16.         public Form2()
  17.         {
  18.             InitializeComponent();
  19.         }
  20.         private void button1_Click(object sender, EventArgs e)
  21.         {
  22.             string connectionString = "datasource=127.0.0.1;port=3306;username=zyrc;password=eloelo67;database=biblioteka";
  23.             MySqlConnection connectDataBase = new MySqlConnection(connectionString);
  24.             MySqlCommand cmdDataBase = new MySqlCommand("SELECT * FROM ksiazka", connectDataBase);
  25.             try
  26.             {
  27.                 MySqlDataAdapter sda = new MySqlDataAdapter();
  28.                 sda.SelectCommand = cmdDataBase;
  29.                 DataTable dbtataset = new DataTable();
  30.                 sda.Fill(dbtataset);
  31.                 BindingSource bSource = new BindingSource();
  32.                 bSource.DataSource = dbtataset;
  33.                 dataGridView1.DataSource = bSource;
  34.                 sda.Update(dbtataset);
  35.             }
  36.             catch (Exception ex)
  37.             {
  38.                 MessageBox.Show(ex.Message);
  39.             }
  40.         }
  41.  
  42.         private void button2_Click(object sender, EventArgs e)
  43.         {
  44.             this.Hide();
  45.             Form3 ss = new Form3();
  46.             ss.Show();
  47.         }
  48.     }
  49. }
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