var sql=require('msnodesql');
var conn_str="Driver={SQL Server Native Client 11.0};Server={127.0.0.1};Database=xxx;uid=sa;PWD=xxx;";
var faqID = "";
var get_result = function(callback) {
sql.open(conn_str, function (err, conn) {
if (err) {
console.log('发生错误');
}
sql.queryRaw(conn_str, "select top 10 * from faq", function (err, results) {
if (err) {
console.log(err);
}
else {
callback(JSON.stringify(results.rows[0][0] + results.rows[0][1]));
}
});
});
}
get_result(function(data){
console.log(data)
faqID = data;
})