DataGridView n'affiche rien
Bonjour à tous,
Je poste ici mon code, simple, mais qui ne marche pas.
Aucun message d'erreur mais le DatGridView n'affiche rien.
Code:
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
| using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Data.SqlTypes;
namespace ConsultGK
{
public partial class Acc : Form
{
private void button1_Click(object sender, EventArgs e)
{
SqlConnection DATA = new SqlConnection();
DATA.ConnectionString = (@"server=192.168.220.136;Database=ConsultGK;trusted_Connection=yes;");
DATA.Open();
SqlDataAdapter conslt_cin = new SqlDataAdapter("select * from Empl", DATA);
DataTable consult_empl = new DataTable();
conslt_cin.Fill(consult_empl);
dataGridView1.DataSource = conslt_cin;
}
} |