我正在尝试使用驱动程序通过节点从 sql server 2008 获取数据。不知何故,我可以成功获取数据。我的问题是如何以 Json 格式显示它。
我的代码是这样的:
execSql("select * from tblStudent", function (err,rows) {
console.log("City_StrCode:" + rows[0].value);
console.log("State_StrCode:" + rows[1].value);
console.log("City_StrName:" + rows[2].value);
});
现在我查询数据库后的结果是这样的:
City_StrCode:0005
State_StrCode:ORS
City_StrName:Ratnagiri12
City_StrCode:1002
State_StrCode:78899
City_StrName:thousandtwo
City_StrCode:1010
State_StrCode:1001
City_StrName:U FOOL34
Status:true
City_StrCode:105
State_StrCode:001
City_StrName:dgrt12
City_StrCode:1789
State_StrCode:001
City_StrName:XZAS12
给我一些建议...