Monthly Archives: September 2011

iostream directive is not enough in VC++ for cout

The famous pain for VC++ learning is the cout using VC++. In other compilers cout only requires iostream.h header but unfortunately this does not work for VC++. VC++ requires another statement using namespace std;   See the complete Hello word … Continue reading

Posted in .Net | Tagged , , | 1 Comment

Visual Studio 11 in Windows 8

Successful installed first Visual Studio 11 public build in first Windows 8 public build.

Posted in .Net | Tagged | 2 Comments

What’s New in ASP.NET 4.5 and Visual Studio 11

What’s New in ASP.NET 4.5 and Visual Studio 11 Resources: http://www.asp.net/vnext/

Posted in .Net | Tagged , | 1 Comment

HTTP Error 500.19 – Internal Server Error – Config Error Cannot read configuration file due to insufficient permissions

When you browse an asp.net web page and you get an error like the one below. ————————————————————————————- HTTP Error 500.19 – Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid. … Continue reading

Posted in .Net | Tagged , , | Leave a comment

SQL Server Code Name "Denali"

SQL Server Code Name “Denali”. What is new in Denali? SQL Server and the Data Explosion

Posted in .Net | Tagged , | Leave a comment

Using ObjectQuery with Entity Framework

Normally we manipulate the Entity Framework using var like the statements below.   BeancurdModel.BeancurdEntities context = new BeancurdModel.BeancurdEntities(); var bc = from b in context.Beancurds select b;   We can actually do it without using var. The below statements are … Continue reading

Posted in .Net | Tagged , | Leave a comment

Using IEnumerable with LINQ

Instead of var IEnumerable can be used accept the result from LINQ.   staticvoid Main(string[] args) {      Model1Container context = newModel1Container();     IEnumerable<Course> result = from r in context.Courses select r;     foreach (Course c in result) … Continue reading

Posted in .Net | Tagged , | 1 Comment

How to pass var as parameter

The sample below is one of the options to pass var to a method as parameter. classProgram {   publicstaticvoid GetData(IQueryable<Course> context)   {       foreach (Course c in context)       {         Console.WriteLine(c.Course_Name);           foreach (Video v in … Continue reading

Posted in .Net | Tagged , | 2 Comments

Factorial using C#

This Factorial code is modified by Chan Yii Yat.   publicclassclsFactorial {   publicstaticlong Fac(long i)   {     return ((i <= 1) ? 1 : (i * Fac(i – 1)));   } }   classMainClass {   publicstaticvoid Main() … Continue reading

Posted in .Net | Tagged | Leave a comment

The base class includes the field ‘MyControl_1′, but its type (MyControl) is not compatible with the type of control (ASP.MyControl_ascx)

Remove the underscore(_) from your class name if you have one. This is for ASP.NET 4.0.   For example, change from   public partial class usercontrols_AuditTrail : System.Web.UI.UserControl   to   public partial class usercontrolsAuditTrail : System.Web.UI.UserControl

Posted in .Net | Tagged , | 1 Comment