Irwsoft Data Framework
|Topics||Using join syntax.|
|Syntaxes||cross join, inner join, left join and right join.|
Irwsoft Data Framework supports three join syntax :
- Cross Join ,
- Inner Join ,
- Outer Join (left, right and full)
These join syntax usually used in select query in common sql database, but you can see it also used in delete query and update query in MySql database.
Example : We want to display all records of Person table that have leader.
PersonTable member = new PersonTable();
// Declare and initiate a new instance PersonTable that represent as leader data
PersonTable leader = new PersonTable();
SqlSelectFrom select = new SqlSelectFrom(member);
// Don’t forget to set connection string !
// NOTE : it is optional if the data-schema class using default connection.
select.ConnectionString = "..."; // [OPTIONAL]
// to display person with his/her leader data,
// we will use INNER-JOIN between member.LeaderId and leader.PersonId
select.Tables.InnerJoin(leader).On.Compare(member.LeaderId, ComparisonOperator.Equal, leader.PersonId);
// Execute the query
Irwsoft.Data.DataView dv = select.Execute();
// here how to access data from DataView by define which column to read the data
String firstNamePerson = dv.Rows[member.FirstName].ToString();
String firstNameLeader = dv.Rows[member.FirstName].ToString();
Related Topics :