1. 下载安装node
? ? ? (win8 2503错误:应该用管理员权限安装node.msi (cmd->?msiexec /package “你的安装文件的全路径”))
2. 安装node-gyp
npm install node-gyp -g
3. 获取node-sqlserver,v8,libuv源代码
git clone?https://github.com/WindowsAzure/node-sqlserver.git git clone?https://github.com/v8/v8.git git clone?https://github.com/joyent/libuv
4. 修改node-sqlserver的binding.gyp文件
'include_dirs': [
???????'src','指向/v8/include','指向/libuv/include'
?????],
5. node-gyp configure( 应该进入到node-sqlserver 目录 )
6. node-gyp build
7. 将lib/sql.js和node-sqlserver.node 复制到任意目录
var sql=require('./sql.js');
var con=sql.open("Driver={SQL Server Native Client 10.0};Server=(local)sqlexpress;Database=c9;Trusted_Connection={Yes}",function(e){
???????con.queryRaw('select * from departments',function(e,r){
???????????console.log(r);
???});
});
(编辑:李大同)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|