Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL: Not equal operator Problem

I am using a not equal operator <> in my sql statement but it doesn't retrieve any record which is not equal to the selected date.

CODE:

 Command = New SqlCommand("SELECT * FROM [Products] WHERE [ParkingStartDate] <> @StartDate", myConn)

 Command.Parameters.AddWithValue("@StartDate", StartDate1)
like image 781
HShbib Avatar asked Aug 30 '26 13:08

HShbib


1 Answers

This won't return anything if either of the following is true:

  • StartDate1 is a NULL
  • ParkingStartDate for all values is a NULL or equal to StartDate1 (obvious one)

Check that you are passing a non-NULL value in StartDate1 and there are records satisfying your condition.

like image 150
Quassnoi Avatar answered Sep 01 '26 04:09

Quassnoi