I am using the mssql library for nodejs to make queries to my Microsoft SQL Database. It first checks if a row exists in the database and if it does, update the values of that row, if not, create a new row. Here is how I have it set up. When executed, it complains that the variable pool does not exist on lines 35 and 38.
How can I use the pool variable which i got from the first then statement, in the third then statement.