Skip to content

Instantly share code, notes, and snippets.

@riccardopirani
Last active March 15, 2018 09:59
Show Gist options
  • Select an option

  • Save riccardopirani/5bccd9675a20fb47bedb165ab6d38e5f to your computer and use it in GitHub Desktop.

Select an option

Save riccardopirani/5bccd9675a20fb47bedb165ab6d38e5f to your computer and use it in GitHub Desktop.
Login.js - Fix
const DbConfig = require('../Config/DatabaseConfig.js');
const sql = require('mssql');
async function Login(Username,Password) {
await sql.connect(DbConfig.config);
const request = new sql.Request();
request.input('Username', sql.VarChar, Username);
request.input('Password', sql.VarChar, Password);
request.output('Totale', sql.Int);
const recordset = await request.query('select count(*) as Totale from Utente where Username=@Username and Password=@Password');
const ret = parseInt(recordset.recordset[0].Totale);
console.log("Valore di ret dentro model: ", ret);
await sql.close();
return ret;
}
module.exports.Login = Login;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment