Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub Connect_To_DB(DB)
- Set DB = Server.CreateObject("ADODB.Connection")
- DB.Open Application("ConnectionStr")
- End Sub
- Dim ConnectionString
- ConnectionString = "DSN=DSNSource;UID=UserName;PWD=password;database=localDB;"
- var express = require('express');
- var app = express();
- app.get('/', function (req, res) {
- var sql = require("mssql");
- // config for your database
- var config = {
- user: 'UserName',
- password: 'password',
- server: 'servername',
- database: 'LocalDB'
- };
- // connect to your database
- sql.connect(config, function (err) {
- if (err) console.log(err);
- // create Request object
- var request = new sql.Request();
- // query to the database and get the records
- request.query('SELECT * FROM Employees', function (err, recordset) {
- if (err) console.log(err)
- // send records as a response
- res.send(recordset);
- });
- });
- });
- var server = app.listen(3000, function () {
- console.log('Server is running..');
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement