1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace MaCDTheque
{
public partial class Main : Form
{
DataSet ds = new DataSet();
SqlConnection cs = new SqlConnection(@"Data Source=PC-LAURENCE\SQLEXPRESS; Initial Catalog=cdtheque; Integrated Security=TRUE");
SqlDataAdapter da = new SqlDataAdapter();
BindingNavigator customersBindingNavigator = new BindingNavigator(true);
BindingSource customersBindingSource = new BindingSource();
public Main()
{
InitializeComponent();
mainNotifyIcon.Icon = Properties.Resources.icone_Compact_Disk;
this.restaurerLaFenêtreToolStripMenuItem.Enabled = false;
}
#region Menu Icone
private void minimiserLaFenêtreToolStripMenuItem_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Normal;
}
private void quitterToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}
private void maximiserLaFenêtreToolStripMenuItem_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Maximized;
}
private void minimiserLaFenêtreToolStripMenuItem1_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
}
private void Main_SizeChanged(object sender, EventArgs e)
{
this.maximiserLaFenêtreToolStripMenuItem.Enabled = !(this.WindowState == FormWindowState.Maximized);
this.restaurerLaFenêtreToolStripMenuItem.Enabled = !(this.WindowState == FormWindowState.Minimized);
this.restaurerLaFenêtreToolStripMenuItem.Enabled = !(this.WindowState == FormWindowState.Normal);
}
private void restaurerLaFenêtreToolStripMenuItem_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Normal;
}
#endregion Menu Icone
private void btnDisplay_Click(object sender, EventArgs e)
{
da.SelectCommand = new SqlCommand
("SELECT al.id_album, al.titre, al.annee, at.nom, g.genre FROM album al INNER JOIN artiste at ON at.id_artiste = al.id_artiste INNER JOIN genre g ON g.id_genre = al.id_genre ", cs);
ds.Clear();
da.Fill(ds);
dataGridViewListeCD.DataSource = ds.Tables[0];
}
}
} |
Partager