i want make a query in filter with date in current year RRS feed

  • Question

  • hi

    i want make a query in filter with date in current year

    if 2019 take just in 2019 and if 2020 and so on

    please help

    Tuesday, July 23, 2019 9:42 AM

All replies

  • this looks works for me

      Using cmdkk As New SqlCommand("select max(DO_Piece) from F_DOCENTETE where DO_Piece like 'ABL%' and DO_Date like'%" & Date.Now.Year & "%'", cn)
                str77 = cmdkk.ExecuteScalar.ToString
                If str77 = "" Then
                    str77 = "ABL" + "10000"
                    str77 = str77.Substring(3)
                    Int32.TryParse(str77, digit)
                    digit = digit + 1
                    str77 = "ABL" + digit.ToString("D5")
                End If
            End Using

    Tuesday, July 23, 2019 10:26 AM
  • Hello,

    For SQL-Server

    SELECT OrderID ,
           CustomerIdentifier ,
           EmployeeID ,
           OrderDate ,
    FROM   dbo.Orders
    WHERE  YEAR(OrderDate) = YEAR(GETDATE());
    For MS-Access YEAR(NOW())

    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    profile for Karen Payne on Stack Exchange

    Tuesday, July 23, 2019 10:30 AM
  • Hi,

    Do you resolve the issue?

    Best Regards,


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Wednesday, July 24, 2019 1:36 AM