Closed CT77777 closed 8 months ago
const request = pool.request() const param = { name: 'coids', type: sql.VarChar, value: ['000020', '000024'], } request.input(param.name, param.type, param.value) const query = 'SELECT coid, fin_type FROM wifina WHERE coid IN (@coids)' const result = await request.query(query) await pool.close() return result.recordset
show below error
RequestError: Validation failed for parameter 'coids'. Invalid string.
then I covert param.value to string, it return empty array.
param.value
You can't parameterise arrays into single values.
Somewhat releated: https://github.com/tediousjs/node-mssql/issues/1575
show below error
then I covert
param.value
to string, it return empty array.