I have a Windows Forms application and want to get information from multiple tables of my database in the single dataGridView area.
I am trying to do it without SqlConnection
and SqlDataAdapter
, so the connection will be proceed through Entity Framework
DBContext db = new DBContext
Is it possible to do so?
I have three tables:
User:
UserID,
Name
System:
SysID,
SysType
Activities:
ActivID,
UserID (FK)
SysID (FK)
Date,
Version,
Changes
My code:
using DBContext db = new DBCntext())
{
dataGridView.DataSource = db.Table.ToList<Table>();
}
So I would write in case of only one table, but would it be possible to concatenate two or more tables without do it right in the database?
At the end I want to get User+System+Activities tables within one dataGridView.