I have a string
, which stores my SQL code, and it looks like this:
'SELECT * FROM myTable WHERE myField LIKE '%2015' AND myOtherField = %d'
First question: How can I use formatting on myOtherField
only? The code below does not seem to ignore the first % sign:
MyQuery.SQL.Add(Format(myString, myNumber));
Second question: How can I use formatting, when I need the first '%' sign for my SQL, but I want to format the date, too? Sadly, the following code does not work either.
'SELECT * FROM myTable WHERE myField LIKE '%%d' AND myOtherField = %d'