Listing 1: DLinqConnect Function using System.Xml.XLinq; using System.Data.DLinq; using System.Data.SqlClient; void DLinqConnect() { SqlConnection cn = new SqlConnection(sConnectionString); cn.Open(); // Pass the connection object or a connection string to the DataContext. DataContext db = new DataContext(cn); db.Connection.Close(); }