I want to populate my DataGridView with data from MySql.
I am using Nhibernate to configure it. I configured it and created the session.
using (var session = sessionf.OpenSession()) //open session
{
var dealers = session.QueryOver<Dealer>().List(); //Query to get the dealers
//please help me what to do after this.
}
How do I bind data to my datagridview?
Please Help. Thanks
I suggest might you fill the datagridview with DATASOURCE property, for example Datagridview.datasource = delers
greetings
This might be too late, but maybe it can be helpful to others in the future. As @Andres suggest, but giving a more complete answer, the solution is the following, use the Datasource property from the dataGridView class, as you can see below:
using (var session = sessionf.OpenSession()) //open session
{
var dealers = session.QueryOver<Dealer>().List(); //Query to get the dealers
dataGridView1.DataSource = dealers; // <- Code you are asking for
}
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.