Open pebanfield opened 11 years ago
I've resolved my issue. There is no issue with the lib.
The problem was that I did not actually need to parameterize the LIKE match expression. I was simply missing some single quotes around the expression. I've modified my query like so -
queryStr = 'SELECT TOP 5 CostCenter value, CostCenterDesc about, LOB lob FROM ServerServiceCostCenters'; queryStr += "WHERE CostCenter LIKE '%" + term + "%'";
and now it works.
I'm trying to use LIKE with WHERE, but I've not gotten it to work so far. My code is something like -
var term = req.query["term"]; queryStr = 'DECLARE @Param1 Int; SELECT TOP 5 CostCenter value, CostCenterDesc about, LOB lob FROM ServerServiceCostCenters '; queryStr += 'WHERE CostCenter LIKE @Param1';
var statement = conn.createStatement(queryStr); statement.execute({Param1: "%" + term + "%"});
This works when I remove the WHERE/LIKE part of the expression. Does this lib support using LIKE? Can you provide a quick code snippet?
Cool module. Nice job. Thanks!
Peter