const loadpic = () => {
return new Promise((resolve, reject)=>{
sql.connect(config).then(
pool =>{
return pool.request()
.input('Names',TYPES.Char,'Roger')
.query('select Email from Account where Names=@Names')
.then((result) =>{
sql.close();
resolve(result);
}).catch(err =>{
if(err) console.log(err);
sql.close();
reject(err);
})
}
)
})
}
loadpic()
.then(result =>{console.log(result)})
.catch(err=>{if(err) console.log(err)})