我的.js SELECT查询结果数据如下:
RowDataPacket {
id: 128,
cnpj: '00055671000150',
razao_social: '',
nome_fantasia: '',
tipo: '',
end_CEP: '',
end_logradouro: '',
end_numero: '',
end_complemento: '',
end_bairro: '',
end_municipio: '',
end_estado: '',
situacao_cadastral: '',
data_situacao: null,
motivo_situacao: '',
situacao_especial: '',
timestamp: 2018-09-25T18:27:41.000Z } ]
如何在datable中加载数据?
我正在使用“管理员仪表板”(https://github.com/puikinsh/Adminator-admin-dashboard),并使用.js连接/选择数据
db_conexao.js
var mysql = require('mysql');
var connection = mysql.createConnection({
host: "MY_HOST",
user: "MY_USER",
password: "*******",
database : 'DATABASE_NAME'
});
connection.connect();
connection.query('SELECT * FROM cnpj_OS_322014 LIMIT 0,2', function (error, results, fields) {
if (error) throw error;
console.log(results);
});