I am using ZeroBrane IDE for lua script and Visual Studio 2015 for C# I can call lua script from C# with normal variable, but I can't run the script with sql-odbc, it's working in zeroBrane only but from c# I can't.
here is c# code
try
{
Lua lua = new Lua();
lua.DoFile("DGT_MSID.lua");
var x = lua.DoString("return GetData()");
Console.WriteLine(x.First().ToString());
} catch(NLua.Exceptions.LuaScriptException ex)
{
Console.WriteLine(ex.Message);
}
DGT_MSID.lua script
function GetData()
require "luasql.odbc"
env = assert(luasql.odbc())
print(env)
con = assert(env:connect("conan", "sa", "p@ssw0rd"))
print(con)
cur = assert (con:execute"use testdb")
cur = assert (con:execute"SELECT MSISD FROM MSID")
row = cur:fetch({}, "a")
while row do
print(string.format("%s",row.MSISD))
row = cur:fetch (row, "a")
end
cur:close()
con:close()
env:close()
return row.MSISD
end
Here is this error:
error loading module 'luasql.odbc' from file '...\Debug\luasql\odbc.dll':The specified module could not be found
I suspect one of the dependencies of odbc.dll is missing or not being loaded (which may be the Lua DLL or some other library it's linked against). You can use dependency walker to get the list of dependencies and even run your application in "profile" mode, which will show all loaded DLLs as well as any failing loads and their related errors.