I have a SQL database with multiple tables and I want to bind one of them to a DataGridView. I use this code : http://msdn.microsoft.com/en-us/library/fbk67b6z.aspx#Y210 But my datagridview only show column names and does not draw any rows. Does anyone can help me ?
If you can see the correct column names but don't see the data, there could be one of these two problems (or both):
EDIT: Have you tried switching these two statements?
Form1_Load(object sender, System.EventArgs e)
{
GetData("select * from Customers");
dataGridView1.DataSource = bindingSource1;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.