Delphi中通过ActiveX从InterSystems Cache获取对象的OID或ID
我在表单上的按钮中获得了以下代码,但我想获取已保存对象的 OID 或 ID 值,以便稍后可以直接加载它。
procedure TFormMain.ButtonNewClick(Sender: TObject);
var
Employee: Variant;
OId: Variant;
begin
Employee := Factory.New('Sample.Employee', True);
if VarIsNull(Employee) or VarIsClear(Employee) then
begin
ShowMessage('Could not create Employee!');
Exit;
end;
Employee.Name := 'Foo Bar';
Employee.SSN := '616-27-7814';
Employee.Sys_Save;
OId := Employee.Sys_getOID; <- This doesn't exist
Employee.Sys_Close;
Employee := NULL;
end;
该文档显示了像 GetId 这样的函数,但它们要求您传递 OID,但我没有看到这样的函数,并且只是 .OID 等不起作用,我有这种感觉,因为所有教程都显示了加载示例通过 OID 或 ID 发现我缺少一些非常基本的东西。
任何指示都会非常有帮助。
谢谢, 布鲁斯
I have got the following code in a button on a form, but I want to get the OID or ID value of the saved object so that I can load it directly later.
procedure TFormMain.ButtonNewClick(Sender: TObject);
var
Employee: Variant;
OId: Variant;
begin
Employee := Factory.New('Sample.Employee', True);
if VarIsNull(Employee) or VarIsClear(Employee) then
begin
ShowMessage('Could not create Employee!');
Exit;
end;
Employee.Name := 'Foo Bar';
Employee.SSN := '616-27-7814';
Employee.Sys_Save;
OId := Employee.Sys_getOID; <- This doesn't exist
Employee.Sys_Close;
Employee := NULL;
end;
The documention shows functions like GetId but they require you to pass in the OID, but I don't see a function for that, and just .OID etc. don't work, I have the feeling since all the tutorials show examples of loading by OID or ID that I am missing something pretty basic.
Any pointers would be very helpful.
Thanks,
Bruce
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试过
Employee.Oid
或Employee.Sys_Oid
?Have you tried
Employee.Oid
orEmployee.Sys_Oid
?阅读 InterSystem Cache 的 ActiveX 对象,我没有看到任何从
Sample.Employee
对象获取 OID 的方法。Reading the documentation for InterSystem Cache's ActiveX objects, I do not see any way to get an OID from a
Sample.Employee
object.