Using Dapper, the following throws are Incorrect syntax near ',' .
const string sql = "select * from ZipToZipDistance z where z.NoRouteFound = 0" + " and z.OriginZip in (@zips) or z.DestZip in (@zips)"; var zipStrings = zips.Select(x => x.ToString()).ToArray(); var result = connection.Query<ZipToZipDistance>(sql, new { zips = zipStrings });
Hmm, SQL has no commas. It should have something to do with the parameter. OriginZip and DestZip are varchar(10) . zips IEnumerable<int> . I tried using zips as a parameter without converting to strings. The same error.
It seems very simple. What am I doing wrong?
Tim scott
source share