Having issue while passing the array of parameters in the WEB API service
public class SampleController : ApiController
{
public string Getdetails([FromUri] int[] id)
{
var inconditions = id.Distinct().ToArray();
using (var dbConn = new OracleConnection("DATA SOURCE=h;PASSWORD=C;PERSIST SECURITY INFO=True;USER ID=T"))
{
dbConn.Open();
var strQuery = "SELECT PRIO_CATEGORY_ID AS PRIO, LANG_ID AS LANG, REC_DATE AS REC, REC_USER AS RECUSER, DESCR, COL_DESCR AS COL, ROW_DESCR AS DROW, ABBR FROM STCD_PRIO_CATEGORY_DESCR WHERE REC_USER IN (:p)";
var queryResult = dbConn.Query<SamModel>(strQuery, new { p = inconditions });
return JsonConvert.SerializeObject(queryResult);
}
}
Now while calling the API as http://localhost:35432/api/Sample?id=1&id=83
it throws an error saying on var queryResult = dbConn.Query(strQuery);
{"ORA-00907: missing right parenthesis"}
Checked all the parenthesis and everything looks good