It is currently November 19th, 2018, 8:13 am

Getting info from MS SQL

Discuss the use of Lua in Script measures.
TrippleT
Posts: 4
Joined: May 28th, 2018, 9:57 pm

Getting info from MS SQL

TrippleT » June 6th, 2018, 11:51 pm

Hi,

Have anyone success with connecting to MS SQL database? I think the issue is with Lua, the information for MSSQL is quite rare. it also doesn't help when Lua doesn't report any error. I am using MS SQL Server 2014, have Management Studio and can open the database using Windows Authentication

function getCurrency()
local dbuser="user"
local dbpass="password"
local dbserver="(local)\\DatabaseSource"
local dbname="databaseName"
local connectionString = "Provider=SQLOLEDB; Initial Catalog ="..dbname..";Data Source ="..dbserver.."; User ID="..dbuser.."; Password = "..dbpass.."
database.open(connectionString)
rs = database.query("SELECT * FROM dbo.CURRENCY")
database.close()
-- get the data out of rs
end