1.นำข้อมูลจาก MySql มา dataGridView อย่างไรครับ ผมทำตามนี้แล้วมันบอกว่า
'System.Windows.Forms.DataGridView' does not contain a definition for 'ItemsSource' and no extension method 'ItemsSource' accepting a first argument of type 'System.Windows.Forms.DataGridView' could be found (are you missing a using directive or an assembly reference?) Code (C#)
private void button2_Click(object sender, EventArgs e)
{
string sql = "SELECT * FROM member";
MySqlConnection con = new MySqlConnection("host=localhost;user=root;password=12345678;database=postsystem");
MySqlCommand cmd = new MySqlCommand(sql, con);
con.Open();
DataSet ds = new DataSet();
MySqlDataAdapter da = new MySqlDataAdapter(cmd);
da.Fill(ds);
dataGridView1.ItemsSource = ds.Tables[0].DefaultView;
con.Close();
}