-
Notifications
You must be signed in to change notification settings - Fork 16
Examples ADODB Connection
Michael Anderson edited this page Dec 12, 2017
·
1 revision
The ActiveX Data Objects driver connects to ActiveX Data Objects file, such as Access (.mdb only) or Excel (.xls only). The adodb driver does not support transactions.
database-js-adodb:///file_path[?parameters]
const Connection = require('database-js2').Connection;
var connection = new Connection('adodb:///C:\\Users\\me\\Desktop\\database.mdb');
var Connection = require('database-js2').Connection;
(async function() {
let connection, statement, rows;
connection = new Connection('adodb:///C:\\Users\\me\\Desktop\\database.mdb');
try {
statement = await connection.prepareStatement("SELECT * FROM tablea WHERE user_name = ?");
rows = await statement.query('not_so_secret_user');
console.log(rows);
} catch (error) {
console.log(error);
} finally {
await connection.close();
}
})();
var Connection = require('database-js2').Connection;
(async function() {
let connection, statement, rows;
connection = new Connection('adodb:///C:\\Users\\me\\Desktop\\database.xls?Extended Properties='Excel 8.0;HDR=Yes;IMEX=1';');
try {
statement = await connection.prepareStatement("SELECT * FROM [Sheet1$A1:C52] WHERE State = ?");
rows = await statement.query('South Dakota');
console.log(rows);
} catch (error) {
console.log(error);
} finally {
await connection.close();
}
})();