如何在不同的数据库中使用@DbLookups [英] How to use @DbLookups in different database
问题描述
好吧,这看起来很傻,但我在让它工作时遇到了一些麻烦.我想对另一个数据库执行 @DbColumn() 或 @DbLookup().相同的服务器 - 但它在一个文件夹中.我无法得到结果.相关数据库的视图按第一列排序.
Ok this seems so silly but I'm having some trouble getting this to work. I want to do an @DbColumn() or @DbLookup() to another database. Same server - BUT it's in a folder. And I can't get a result. The view of the database in question is sorted by the first column.
我正在尝试填充组合框的选项.
I'm trying to populate choices of a combobox.
我试过内置在@DbColumn():
I've tried that built in @DbColumn():
var dbname = new Array("", "myfolder\\myDB.nsf");
return @DbColumn(dbname, "byCode", 0)
我已经尝试过使用和不使用双斜线"以及第 0 列和第 1 列.
I've tried that with and without the "double slashes" and with column 0 and also column 1.
我也试过 XSnippet :http://openntf.org/XSnippets.nsf/snippet.xsp?id=dblookup-dbcolumn-with-cache-sort-and-unique
I've also tried the XSnippet : http://openntf.org/XSnippets.nsf/snippet.xsp?id=dblookup-dbcolumn-with-cache-sort-and-unique
由于缓存,这将是我的首选方法.我尝试创建一个 SSJS 函数:
That would be my preferred method really because of caching. I tried creating a SSJS function:
function getFacilityList() {
var dbPath = database.getFilePath().split(database.getFileName())[0];
return DbColumnArray("","myfolder\\myDB.nsf","cache", "sort", "byCode", 0)
}
我认为应该有效但没有.
Which I think should have worked but did not.
任何想法将不胜感激!谢谢
Any thoughts would be appreciated! Thanks
推荐答案
尝试:
var dbname = session.getServerName() + "!!" + "myfolder\\myDB.nsf";
return @DbColumn(dbname, "byCode", 0)
这篇关于如何在不同的数据库中使用@DbLookups的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!