How can I change my vb.net SQL Statement for Like instead of equal ?

whoopdeedo5555

New member
command = New SqlCommand("SELECT COUNT(*) FROM VACATIONDAY WHERE EmployeeID = @ClockNo AND CONVERT(DATETIME,DayRequested,102)= @DayRequested AND Status = @Status OR EmployeeID = @ClockNo AND CONVERT(DATETIME,DayRequested,102)=@DayRequested AND Status = @Status2 OR EmployeeID = @ClockNo AND CONVERT(DATETIME,DayRequested,102)=@DayRequested AND Status = @Status3")

I want parameter Status2 and Status3 to be Like not Equal. For example I want to return if Status has the word Pending anywhere in it.

Thanks

Here is my parameters:

command.Parameters.AddWithValue("@ClockNo", oEmployee.ClockNo)
command.Parameters.AddWithValue("@DayRequested", dtDate.Date)
command.Parameters.AddWithValue("@Status", "Approved")
command.Parameters.AddWithValue("@Status2", "Pending")
command.Parameters.AddWithValue("@Status3", "Submitted")
 
Back
Top