The following code passes this row. The last column is named toscode
. I am trying to weed out rows whose toscolumn
contains "W1" anywhere in the name. No columns are set up as an index. Doesn't work.
I read that the $
(escape) in front of W1
is to prevent SQL injection. Not sure what the %
do, but it might have to do with indexes which is maybe why it doesn't work.
| SPX | 0 | 8.3 | 8.7 | 2017-03-24 | 0 | 30 | PUT | 2400 | SPXW170324C02400000 | .SPXW1703242400 |
MySqlCommand cmd = conn.CreateCommand();
cmd.Parameters.AddWithValue("@symbol", symbol);
cmd.CommandText = @"select *
from contractdetails
where symbol = @symbol
&& toscode NOT LIKE '%$W1%'
&& Type = 'PUT'
&& oBid > .09
&& not ITM
&& Days > 10
&& Days < 120
order by Days asc";