[2005] Anything less than a value?
As per the code:
Code:
Using command As New MySql.Data.MySqlClient.MySqlCommand("select NextDue from Company_ID where NextDue = '" & todaysdate & "'", connection)
Where todaysdate is, I actually want it to look for anything less than that. Any ideas?
I was trying "& < todaysdate &", but it needs something before it to reference off of.
In a sense, the program is looking for dates that are were due before today's date.
Re: [2005] Anything less than a value?
Look at your code:
Code:
NextDue = '" & todaysdate & "'"
If you want to get values less than, intead of equal to, the value then would you not just replace the = with <? Why would the less than sign go outside the double quotes when the equal sign is inside?
Code:
NextDue < '" & todaysdate & "'"
That said, you should NOT be using string concatenation to build SQL statements. You should be using parameters, which is the proper way:
vb.net Code:
Using command As New MySqlCommand("SELECT NextDue FROM Company_ID WHERE NextDue < ?Today", connection)
command.Parameters.AddWithValue("?Today", Date.Today)
Re: [2005] Anything less than a value?
I didnt think you could use a < instead of = in a MySQL statement.
Re: [2005] Anything less than a value?
Quote:
Originally Posted by TCarter
I didnt think you could use a < instead of = in a MySQL statement.
Hmmm... I've never used MySQL so I couldn't say. I just assumed. Maybe you're right but I find it difficult to believe that an enterprise grade database like MySQL wouldn't support a less than operator.