如何在Powerbuilder中运行SQL语句并在Excel中显示结果?

时间:2021-04-24 20:25:08

Is it possible to have a SQL statement in powerbuilder, but instead of the results displaying in a datawindow, have it displayed in Excel? I'm not able to find anything on this topic, and I'm relatively new to powerbuilder and programming.

是否可以在powerbuilder中使用SQL语句,而不是在datawindow中显示结果,而是在Excel中显示?我不能在这个主题上找到任何东西,而且我对powerbuilder和编程来说是比较新的。

Thanks in Advance.

提前谢谢。

2 个解决方案

#1


1  

Use a nonvisual datastore class instead of a datawindow control.

使用非可视的数据存储类而不是datawindow控件。

Retrieve the data into the datastore class;
Use SaveAs() to save the data as an Excel file into the filesystem;
Use Run( "..path to Excel.exe" "XLSX file you just created", maximized!) to launch Excel and load the file;

将数据检索到datastore类;使用SaveAs()将数据作为Excel文件保存到文件系统中;使用运行(“. .Excel。exe“您刚刚创建的XLSX文件”,最大化!)启动Excel并加载文件;

#2


0  

Have a look at the OLE functions in powerbuilder. Be aware though that you will create a dependency on third party software. If ms changes something in excel and breaks your object in PB, good luck fixing that.

看看powerbuilder中的OLE函数。但是请注意,您将创建对第三方软件的依赖。如果ms在excel中修改了一些东西,并在PB中破坏了您的对象,祝您好运。

#1


1  

Use a nonvisual datastore class instead of a datawindow control.

使用非可视的数据存储类而不是datawindow控件。

Retrieve the data into the datastore class;
Use SaveAs() to save the data as an Excel file into the filesystem;
Use Run( "..path to Excel.exe" "XLSX file you just created", maximized!) to launch Excel and load the file;

将数据检索到datastore类;使用SaveAs()将数据作为Excel文件保存到文件系统中;使用运行(“. .Excel。exe“您刚刚创建的XLSX文件”,最大化!)启动Excel并加载文件;

#2


0  

Have a look at the OLE functions in powerbuilder. Be aware though that you will create a dependency on third party software. If ms changes something in excel and breaks your object in PB, good luck fixing that.

看看powerbuilder中的OLE函数。但是请注意,您将创建对第三方软件的依赖。如果ms在excel中修改了一些东西,并在PB中破坏了您的对象,祝您好运。