nodejs+mysql入门实例(改)
//连接数据库
var mysql = require('mysql');
var connection = mysql.createConnection({
host: 'bdm253137448.my3w.com', //数据库地址
user: 'bdm253137448', //数据库用户名
password: 'muchengfeng123', //数据库管理密码
database:'bdm253137448_db', //数据库名称
insecureAuth: true
}); connection.connect(function(err) {
if (err) {
console.error('error connecting: ' + err.stack);
return;
} console.log('connected as id ' + connection.threadId);
}); var userModSql = 'UPDATE userinfo SET username = ?,pwd = ? WHERE id = 1';
var userModSql_Params = ['Hello World',99];
//改 up
connection.query(userModSql,userModSql_Params,function (err, result) {
if(err){
console.log('[UPDATE ERROR] - ',err.message);
return;
}
console.log('----------UPDATE-------------');
console.log('UPDATE affectedRows',result.affectedRows);
console.log('******************************');
});
//关闭连接
connection.end();
nodejs+mysql入门实例(改)的更多相关文章
- nodejs+mysql入门实例
此前我已准备好mysql,使用的是PHP的组合包Appserv 手动添加数据库依赖: 在package.json的dependencies中新增, “mysql” : “latest”, { &quo ...
- nodejs+mysql入门实例(删)
//连接数据库 var mysql = require('mysql'); var connection = mysql.createConnection({ host: 'bdm253137448. ...
- nodejs+mysql入门实例(表的查询)
//连接数据库 var mysql = require('mysql'); var connection = mysql.createConnection({ host: '******', //数据 ...
- nodejs+mysql入门实例(链接到数据库)
//连接数据库 var mysql = require('mysql'); var connection = mysql.createConnection({ host: '******', //数据 ...
- nodejs+mysql入门实例(增)
var userAddSql = 'INSERT INTO userinfo(id,username,pwd) VALUES(0,?,?)'; var userAddSql_Params = ['Wi ...
- Angular4+NodeJs+MySQL 入门-06 接口配置
在上篇中说了怎么调用接口,这篇就来说说,接口配置吧. 后端是用NodeJS来写的,由于写后台(以前用的是C#语言)的时候,大部操作都在是对数据库表的增.删.改.查操作, 比如:根据查询出来的数据,然后 ...
- Angular4+NodeJs+MySQL 入门-05 接口调用
接口调用 今天讲一下,如果在前端页面上通过调用后台接口,返回来的数据.把前面的几章结合起来. 这里所有用的代码在 https://github.com/xiaotuni/angular-map-htt ...
- Angular4+NodeJs+MySQL 入门-02 MySql操作类
NodeJs操作MySQL类 此类封装了几个常用的方法:插入,更新,删除,查询,开启事务,事务提交,事务回滚等操作.有一这个类,操作MYSQL就方便多了. 批处理,存储过程等方法还没有添加,因为觉得目 ...
- Angular4+NodeJs+MySQL 入门-01
有一定的后台开发经验ES6语法.后台没有用框架来,纯自己写.会sql语句 安装NodeJS的安装 从网上下载 https://nodejs.org/en/ 选择自己,我用的是最新版本 Angular ...
随机推荐
- 静态,关键字:static 接口,IUSB , API 接口关键字:interface
//静态 //普通成员 //普通成员是属于对象的 //静态成员 //静态成员属于类的 //关键字:static //self关键字:在类里面代表该类 //在静态方法里面不能调用普通成员 //在普通方法 ...
- Maven本地库_remote.repositories文件
本地库中的包都有一个_remote.repositories文件,示例: #NOTE: This is an Aether internal implementation file, its form ...
- POJ 3635 - Full Tank? - [最短路变形][优先队列优化Dijkstra]
题目链接:http://poj.org/problem?id=3635 Description After going through the receipts from your car trip ...
- 1.7Oob 方法体中的循环也能也能返回值给方法
public String monthString(int monthNumber){ switch(monthNumber){ case 1: return "january"; ...
- Exception 04 : java.lang.ClassNotFoundException: Could not load requested class : org.hsqldb.jdbcDriver
异常详细信息 org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [org ...
- Page6:关于能控性、能观性、能测性及其判据(1)[Linear System Theory]
内容包含能控性和能测性的定义,连续时间线性时不变系统能控性和能观测性判据
- idea 在tomcat启动的时候发现控制台输出的是乱码
先前觉得是tomcat的问题,后来发现是idea的问题: 打开IntelliJ IDEA本地安装目录中bin文件夹下的idea.exe.vmoptions和idea64.exe.vmoptions这两 ...
- python中由于中文路径引起的os.path.isfile(imgpath) == False问题
昨天在用python脚本处理文件的时候,遇到了题述问题,明明文件时存在的,但是在用os.path.isfile(imgpath) == False进行判断的时候总是成立,在一开始以为是正反斜杠wind ...
- 关于安装SVN Service 出错 Service 'VisualSVN Server' failed to start. Please check VisualSVN Server log in Event Viewer for more details
关于安装SVN Service 出错 Service 'VisualSVN Server' failed to start. Please check VisualSVN Server log in ...
- Innodb buffer 相关参数
buffer相关参数: show GLOBAL VARIABLES LIKE 'innodb_buffer_pool_instances'; show GLOBAL VARIABLES LIKE 'i ...