Thanks to visit codestin.com
Credit goes to github.com

Skip to content

How to Properly Construct a WHERE Clause with Date Filtering in getinvoices (C#) #597

@myyoel

Description

@myyoel

Image
Description:
I’m trying to filter a list of invoices using a WHERE clause that includes a date condition. I’m encountering a type mismatch error when comparing a DateTime? field (DueDate) with a string representation of a date.

"Message": "Operator '>' incompatible with operand types 'DateTime?' and 'String'"

// Incorrect approach causing the error
var where = "Type=="ACCPAY" AND DueDate > "2024-01-01" ";
// Assume getinvoices() is a method/property that uses this "where" clause
// e.g. getinvoices(where);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions