Thursday 27 June 2013

VB.NET - How to fix error vb.net Cannot cast DBNull.Value to type 'System.DateTime'. Please use a nullable type.

Replace
TransactionDate Or b.Field(Of DateTime)("tdate") Is Nothing)
With
TransactionDate Or b.Field(Of DateTime?)("tdate") Is Nothing)

Thursday 13 June 2013

C# - How to fix error Backing field for automatically implemented property '' must be fully assigned before control is returned to the caller. Consider calling the default constructor from a constructor initializer.

Backing field for automatically implemented property '' must be fully assigned before control is returned to the caller. Consider calling the default constructor from a constructor initializer. 

Watch online:


Replace

    public struct Users
    {
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public bool IsSalary { get; set; }

        public Users(string fn, string ln, bool sal)
        {
            FirstName = fn;
            this.LastName = ln;
            this.IsSalary = sal;
        }
    }

With

    public struct Users
    {
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public bool IsSalary { get; set; }

        public Users(string fn, string ln, bool sal)
            : this()
        {
            FirstName = fn;
            this.LastName = ln;
            this.IsSalary = sal;
        }
    }