79085372

Date: 2024-10-14 08:43:47
Score: 0.5
Natty:
Report link

Found the solution on this page https://github.com/typeorm/typeorm/issues/881. typeORM has multiple different ways to declare variables but which one is valid depends on the underlying driver. I was using mssql and mssql requires that we declare our parameters as @0, @1... and so on. So the correct query is

`INSERT INTO form_transaction_setup(value1, value2, value3, value4, value5 ,..., value19)
VALUES('${value1}', '${value2}','${value3}', '${value4}', @0 , ... , '${value19}',[value5])`

and then declaring the parameter normally as follows

await getConnection().query("our corrected query here"), [value5]
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: hamza malik