Last active
March 15, 2018 09:59
-
-
Save riccardopirani/5bccd9675a20fb47bedb165ab6d38e5f to your computer and use it in GitHub Desktop.
Login.js - Fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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