Irwsoft Data Framework

Select Record/s from a Table
Brief Information
EditionsAll Editions
TopicsSelect from Table.

This sample will show how to display records from a single table. It will also show how to using conditions in select query.

Example :

  1. Here is Person table dataschema class used for this sample codes.
  2. Select records from Person table which first name is 'Andy'.
C# code
// Declare and initiate a new instance PersonTable.
PersonTable person = new PersonTable();

// using SqlSelectFrom to use select SQL-object
SqlSelectFrom select = new SqlSelectFrom(person);

// Don’t forget to set connection string !
// NOTE : it is optional if the data-schema class using default connection.

select.ConnectionString = "...";  // [OPTIONAL]

// NOTE : if you not specify the column, all columns will be included !
select.Columns.All(person);  // [OPTIONAL]
//        you can filter columns to display selected columns like codes below :
// select.Columns.All(person.PersonID);
// select.Columns.All(person.FirstName);

// Set where condition FirstName = "Andy"
select.Where.Compare(person.FirstName, ComparisonOperator.Equal, "Andy");

// Execute the query and return DataView instance that provide properties and methods to access data
// Note : DataView provide paging feature.

Irwsoft.Data.DataView dv = select.Execute();



How to use Irwsoft Data Framework


Related Topics :

Irwsoft Data Ultimate Edition provides comprehensive features of Irwsoft Data Framework and support from irwsoft.