外部“ Hello World”具有Powerbuilder生成的DLL的SQL Anywhere中的功能 [英] External "Hello World" Function in SQL Anywhere with Powerbuilder-generated DLL

查看:213
本文介绍了外部“ Hello World”具有Powerbuilder生成的DLL的SQL Anywhere中的功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在PowerBuilder.NET Hello World 中创建了一个函数。从PowerBuilder实用程序以C#生成的项目编译为 Helloworld.dll 。在Helloworld中,我制作了非可视的 n_cst_helloworld 。在非可视内部,我创建了对象函数 of_hello()。这些是我尝试在SQL Anywhere的外部函数中访问 Helloworld.n_cst_helloworld.of_hello()时遇到的问题。



外部函数使用 CLR ,现在在 Interactive SQL 中被调用。



这是我要启动的脚本在iSQL中(通过ASA):

 更改过程 DBA。 ext_helloworld()

外部名称

'helloworld.dll :: Helloworld.n_cst_helloworld.of_hello()'

语言CLR

然后,我在iSQL中使用以下内容:

 开始外部环境CLR ; 

呼叫ext_helloworld();

然后给我以下错误:



< blockquote>

无法执行语句。过程'ext_helloworld'因未处理的异常'方法'Helloworld.n_cst_helloworld.of_hello'终止而终止。'



SQLCODE = -91


所以,我知道我将对象保存在正确的文件夹中,并通过REGASM等进行了注册,否则将给我以下错误:我以前见过的找不到对象。



我很困惑,因为似乎SQL Anywhere知道对象n_cst_helloworld存在,但它无法识别使用PowerBuilder.NET实用程序生成的方法。我不知道如何继续通过ASA使用此方法。



当前,我正在使用ASA 12,PB12,PB.NET,并且两者均使用3.5和4.0已安装。

解决方案

.NET部署的工作原理






在部署.NET项目时,PowerBuilder会将现有或新开发的PowerScript®代码编译到.NET程序集中。



在运行时,生成的.NET程序集使用.NET公共语言运行库(CLR)执行。 PowerBuilder的.NET编译器技术与标准PowerBuilder客户端-服务器应用程序中的P代码编译器一样透明。



部署PowerBuilder运行时文件

将PowerBuilder运行时DLL和.NET程序集部署到生产服务器或目标计算机的最简单方法是使用 PowerBuilder Runtime Packager 工具。运行时打包程序将创建一个MSI文件,该文件将安装您选择的文件,注册所有自注册DLL,然后将.NET程序集安装到全局程序集缓存(GAC)中。






请参阅完整的PB.NET运行时文档 HERE 在Sybase Infocenter上






部署清单



验证生产服务器和目标计算机是否满足运行从PowerBuilder Classic部署的.NET目标的所有要求。 / p>

所有.NET目标的清单



用于部署所有.NET目标类型(Windows窗体,Web窗体, .NET程序集 、. NET Web服务),生产服务器或目标计算机必须具有:




  • Windows XP SP2,Windows Vista,Windows 2008或Windows 7操作系统
    .NET Framework 4.0

  • Microsoft Visual C ++运行时库msvcr71.dll,msvcp71.dll,msvcp100.dll,msvcr100.dll和Microsoft .NET活动模板库(ATL)模块atl71.dll

  • 全局程序集缓存(GAC)中的PowerBuilder .NET程序集

  • PowerBuilder运行时动态链接库在系统路径中

  • 请参阅部署PowerBuilder运行时文件。






请参阅完整的部署清单文件 HERE 在Sybase Infocenter上





I created a function in PowerBuilder.NET Hello World. The project compiled as Helloworld.dll, generated in C# from the PowerBuilder utility. Inside Helloworld, I made the non-visual n_cst_helloworld. Inside the non-visual, I made the object function of_hello(). These are the issues I encountered when trying to access Helloworld.n_cst_helloworld.of_hello() in an external function on SQL Anywhere.

The external function uses CLR and is called in Interactive SQL right now.

Here is the script I'm trying to launch in iSQL (through ASA):

ALTER PROCEDURE  "DBA"."ext_helloworld"()

EXTERNAL NAME

'helloworld.dll::Helloworld.n_cst_helloworld.of_hello( )' 

LANGUAGE CLR

Then, I use the following in iSQL:

START EXTERNAL ENVIRONMENT CLR; 

CALL ext_helloworld();

Which then gives me the following error:

Could not execute statement. Procedure 'ext_helloworld' terminated with unhandled exception 'Method 'Helloworld.n_cst_helloworld.of_hello' not found.'

SQLCODE = -91

So, I know that I have the object in the correct folder, and registered through REGASM and all that, otherwise it would give me the error of "object not found" that I'd seen before.

I'm confused because it seems that SQL Anywhere knows that the object n_cst_helloworld exists, but it doesn't recognize the methods that were generated using the PowerBuilder.NET utility. I don't know how to proceed to be able to use this method through ASA.

Currently I'm using ASA 12, PB12, PB.NET and have both 3.5 and 4.0 installed.

解决方案

How .NET Deployment Works


When you deploy a .NET project, PowerBuilder compiles existing or newly developed PowerScript® code into .NET assemblies.

At runtime, the generated .NET assemblies execute using the .NET Common Language Runtime (CLR). PowerBuilder’s .NET compiler technology is as transparent as the P-code compiler in standard PowerBuilder client-server applications.

Deploying PowerBuilder runtime files

The simplest way to deploy PowerBuilder runtime DLLs and .NET assemblies to production servers or target computers is to use the PowerBuilder Runtime Packager tool. The Runtime Packager creates an MSI file that installs the files you select, registers any self-registering DLLs, and installs the .NET assemblies into the global assembly cache (GAC).


See full document PB.NET runtimes HERE on Sybase Infocenter


Checklist for Deployment

Verify that production servers and target computers meet all requirements for running the .NET targets that you deploy from PowerBuilder Classic.

Checklist for all .NET targets

For deployment of all .NET target types (Windows Forms, Web Forms, .NET Assembly, .NET Web Service), production servers or target computers must have:

  • The Windows XP SP2, Windows Vista, Windows 2008, or Windows 7 operating system .NET Framework 4.0
  • The Microsoft Visual C++ runtime libraries msvcr71.dll, msvcp71.dll, msvcp100.dll, msvcr100.dll, and the Microsoft .NET Active Template Library (ATL) module, atl71.dll
  • PowerBuilder .NET assemblies in the global assembly cache (GAC)
  • PowerBuilder runtime dynamic link libraries in the system path
  • See Deploying PowerBuilder runtime files.

See full set of deployment checklist documents HERE on Sybase Infocenter


这篇关于外部“ Hello World”具有Powerbuilder生成的DLL的SQL Anywhere中的功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆