//Sample C# Program
using System;				 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Data.Linq; 
using System.Data.SqlClient; 
using System.Data.Linq.Mapping; 
       
namespace DLINQTesting 
 	 
 class DisplayDLINQ 
 { 
   static void Main(string[] args) 
   {
    Northwind northwindDB = new Northwind("Integrated Security=true;" +
     "Initial Catalog=Northwind;Data Source=Lxxxxxxxx-XX\\SQLExpress");
    try
    {
     Console.Write("Enter a number: ");
     string customerId = Console.ReadLine();
     var testQ  = from x in northwindDB.XTable
             	  where String.Equals(x.CID, cId)
                  select x;
     foreach (var testo in testQ)
      if (testo.SD == null)
       {
         Console.WriteLine("testo {0} not sent\n\n", testo.OID);
       }
       else
        {
         Console.WriteLine("testo: {0}\nEntered: {1}\nSent: {2}\n" +
                "To Loc: [3}\n{4}\n{5}\n{6}\n\n", testo.OID,
                testo.ODate, testo.SDate, testo.SN, testo.SA,
                testo.Sty, testo.Stry);
        }
     }
     catch (SqlException e)
     {
      Console.WriteLine("Database problems: {0}", e.Message);
     }
    }
  } 
          
  [Table(Name = "XTable")]
   public class xtab
   {
    [Column(IsPrimaryKey = true, CanBeNull = false)]
    public int OID { get; set; }
    [Column]
    public string CID { get; set; }
    [Column]
    public DateTime? ODate { get; set; }
    [Column]
    public DateTime? SDate { get; set; }
    [Column]
    public string SN { get; set; }
    [Column]
    public string SA { get; set; }
    [Column]
    public string Sty { get; set; }
    [Column]
    public string Stry { get; set; }
   }
   public class Northwind : DataContext
   {
    public Table xtab;
    public Northwind(string cF) : base (cF)
   {
  }
 }   
}