Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Heres a method that I have Used....</p> <p>First off, build a class to represent a Table in your DataBase :-</p> <pre><code>public class Contact { public int ContactID { get; set; } public string Surname { get; set; } public string Forename { get; set; } public string MobileNumber { get; set; } public string EmailAddress { get; set; } public string Information { get; set; } } </code></pre> <p>Then I load this Data into an IEnumerable List :-</p> <pre><code>public List&lt;Contact&gt; GetContacts() { DataTable dt = new DataTable(); OleDbCommand cmd = new OleDbCommand("SELECT * FROM [Contacts]", Connection); Adapter.SelectCommand = cmd; Connection.Open(); Adapter.SelectCommand.ExecuteNonQuery(); Adapter.Fill(dt); Connection.Close(); var Contacts = (from row in dt.AsEnumerable() select new Contact { ContactID = row.Field&lt;int&gt;("ContactID"), Surname = row.Field&lt;string&gt;("Surname"), Forename = row.Field&lt;string&gt;("Forename"), MobileNumber = row.Field&lt;string&gt;("MobileNumber"), EmailAddress = row.Field&lt;string&gt;("EmailAddress"), Information = row.Field&lt;string&gt;("Information") }).ToList(); return Contacts; } </code></pre> <p>In My application I create an Instance of this Object :-</p> <pre><code> public List&lt;Contact&gt; contactData; contactData = dc.GetContacts(); </code></pre> <p>I now have the power to manipulate the data using LINQ :-</p> <pre><code>var Query = ConactData.Where(item=&gt; item.ContactID == 10) .Select(item=&gt; item.Surname).toString(); </code></pre> <p>You can use LINQ to query your Data and store it as Lists, Strings etc etc.</p> <p>Hope This Helps.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload