ADO.NET Entity Framework means many things to many people.  At it’s core, however, it allows for Object Relational Mapping (ORM) by providing a layer of abstraction between relational databases and Object Oriented domain objects. The first version of Entity Framework was introduced with .NET Framework 3.5 SP1 and Visual Studio 2008 SP1.  While the intention… Read More


Depending upon a value in the data source, we can conditionally display images in GridView columns. For example, the following TemplateField declaration conditionally displays approved.gif or unapproved.gif based on IsApproved flag in the DataSet that the GridView is bound to: [sourcecode lang=”csharp”]… Read More


ADO.NET offers the capability to add calculated columns in typed DataSets and use the Expression property of the those columns to specify the formulae for calculations. What I did not realize is that you must use the Fill method of the adapter instead of the Get method for calculated columns to properly populate. For example:… Read More


In order to retreive table schema programatically, we can use the GetSchemaTable method of the DataReader as follows: [sourcecode lang=’csharp’] using (OleDbConnection cn = new OleDbConnection()) { OleDbCommand cmd; DataTable schemaTable; OleDbDataReader reader; cn.ConnectionString = @”Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Northwind;Data Source=(local);”; cn.Open(); cmd = new OleDbCommand(“Employees”, cn); cmd.CommandType = CommandType.TableDirect; using (reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly |… Read More