So maybe everyone has this feature in their blog software, but this is the first time I have seen this since I am new to the blogging scene. There is a feature in BlogEngine that allows you to insert code into your post. It parses out C#, J#, VB.NET, T-SQL and ASPX. Pretty Sweet! So testing this, I have posted a method to data access class in a current personal project I am working on.
public BaseCollection ExecuteDataReader(string proc, ObjectPopulate populate, BaseCollection collection)
{
SqlConnection connection =new SqlConnection(_connectionString);
SqlCommand command =new SqlCommand(proc, connection);
command.CommandType = CommandType.StoredProcedure;
SqlDataReader dr =null;
try
{
connection.Open();
dr = command.ExecuteReader(CommandBehavior.Default);
while (dr.Read())
{
collection.Add(populate(dr));
}
return collection;
}
finally
{
if (dr !=null && !dr.IsClosed)
{
dr.Close();
}
connection.Dispose();
command.Dispose();
}
}
No Comments on "Insert Code Feature"