Why is my Like query liked by Toad but not liked by C#?
c#, oracle, sql, sql-like
Solution
Well, "presumably the equivalent" clearly isn't equivalent, given that it doesn't work. Your parameter name is inside quotes, so it's not being treated as a parameter. I suspect you want:
const string sql = @"SELECT BANDID, BANDNAME
FROM WOODSTOCK
WHERE BANDNAME LIKE :BANDNAMEPORTION";
. . .
ocmd.Parameters.Add("BANDNAMEPORTION", "%" + BandNamePortion + "%");
Problem
If I run this query in Toad: ``` SELECT BANDID, BANDNAME FROM WOODSTOCK WHERE BANDNAME LIKE '%THE%' ``` ..it works just dandy, and returns a bunch of rows. However, what is presumably the equivalent in code: ``` const string sql = @"SELECT BANDID, BANDNAME FROM WOODSTOCK WHERE BANDNAME LIKE '%:BANDNAMEPORTION%'"; . . . ocmd.Parameters.Add("BANDNAMEPORTION", BandNamePortion); . . . ``` ...returns no records.