Tuesday, December 10, 2013

Just to remind this day

Just wanted to post this to remind myself later whenever I read my blog. Today is 11-12-13, This is special day and never come again. Well, every day is unique and never come again but still today date looks special to me.

            11-12-13

I have also seen below Iconic date but never did any special to remind
  • 12-12-12
  • 11-11-11
  • 10-10-10
  • 8-8-88

Friday, September 27, 2013

Internet Explorer 11 error 'This page can't be displayed'

Internet Explorer 11 error 'This page can't be displayed'

Suddenly my web page start giving this error ('This page can't be displayed') after Window update to 8.0 to 8.1, after few days research I found that new feature has been added into IE 11

  • Enabled Enhanced Protected Mode

and by default this option is checked, to resolved this issue, we have to unchecked this option.
Possible cause: the sites which used SSL certificate that may start giving this issues after Window update from 8.0 to 8.1.

Error





Wednesday, July 10, 2013

Set Default Value for the property C#.

See the different way to set default value for the property below

Namespace
using System.ComponentModel;

Source Code
//Set default value for the property using Default Attribute
public class SetDefaultPropertyValueByAttribute
{
   [DefaultValue(100)]
   public int Id { get; set; }

   [DefaultValue("Ritesh")]
   public string Name { get; set; }

   [DefaultValue(true)]
   public bool IsBool { get; set; }

   [DefaultValue("01/01/2013")]
   public DateTime DateOfBirth { get; set; }

}

We normally set default value to the property like below

Namespace
using System;

Source Code

//Set default value for the property using variable declaration
public class SetDefaultPropertyValueByVariable
{
   private int id = 100;
   private string name = "Ritesh";
   private bool isBool = true;
   private DateTime dateOfBirth = DateTime.UtcNow;

   public int Id
   {
      get { return this.id; }
      set { this.id = value; }
   }

   public string Name
   {
      get { return this.name; }
      set { this.name = value; }
   }

   public bool IsBool
   {
      get { return this.isBool; }
      set { this.isBool = value; }
   }

   public DateTime DateOfBirth
   {
       get { return this.dateOfBirth; }
       set { this.dateOfBirth = value; }
    }
 }

Tuesday, June 18, 2013

Need Start Button on Window 8

If you are missing start button on Window 8, try http://www.startisback.com/

you can buy with very nominal charges. E N J O Y ......


Thursday, February 21, 2013

Error: Unable to Open Database Project in Visual Studio 2012:

Error: Unable to Open Database Project in Visual Studio 2012: This version of SQL Server Data Tools is not compatible with the database run time components installed on this.


To fix this problem you need to install SQL Server Data Tools – November 2012 update

then try opening same project, you will get instruction saying (needs migration) with project file,
To migrate your project you need to Right Click on the Project name and select “Reload Project”.

All done here.

Friday, February 08, 2013

Error: "No column name was specified for column 1 of 'SOURCE'" in SQL Server Merge statement

when I was working with Merge statement with SQL Server 2008 then while writing this I got this error and after couple of min i got the issues 

Declare
      @Id         Int = 10,
      @Name       Varchar(20) = 'Kesharwani',
      @Salary     Int = 30000
          
MERGE INTO [Temp] as TARGET
      USING (SELECT @Id,@Name,@Salary) AS
SOURCE ON TARGET.empId = SOURCE.empId
      WHEN MATCHED THEN
            UPDATE SET Name=SOURCE.Name, Salary =SOURCE.Salary
      WHEN NOT MATCHED THEN
            INSERT (empId,Name,Salary)
VALUES (SOURCE.empId,SOURCE.Name,SOURCE.Salary);

While running above query sometime I got this error: No column name was specified for column 1 of 'SOURCE'.

The problem in the above query the alias name not there on the columns in Select statement, to resolve this error above query can be written in following way

Declare
      @Id         Int = 10,
      @Name       Varchar(20) = 'Kesharwani',
      @Salary     Int = 30000
          
MERGE INTO [Temp] as TARGET
      USING (SELECT @Id AS empId,@Name AS Name,@Salary AS Salary) AS
SOURCE ON TARGET.empId = SOURCE.empId
      WHEN MATCHED THEN
            UPDATE SET Name=SOURCE.Name, Salary =SOURCE.Salary
      WHEN NOT MATCHED THEN
            INSERT (empId,Name,Salary)
VALUES (SOURCE.empId,SOURCE.Name,SOURCE.Salary);