1. James Whitehead
  2. Valentina Reports ADK
  3. Freitag, September 22 2023, 11:24 PM
  4.  Abonnieren via E-Mail
I'm having problems printing a report from my Xojo application, using a Vserver.
I have licensed versions of VStudio Pro 13.3.3, VServer 13.3, and the Xojo/RealBasic ADK, all running on Linux (Ubuntu 22.4) [ all from the OmegaBundle 2023]. I have successfully developed a project ("femstest";) and report ("Report_Offer";) on the Vserver. The datasource is a MSSQL database on another machine. When I preview the report in VStudio, I get the expected report output. Now, I'm trying to print this same report from within my Xojo Web (Version 2023.1.1) application. I followed the steps shown in the Xojo ADK installation video. Here is my Xojo code behind the "print" button (it's basically Valentina's example code):


try

'Open Connection
Var conn as VConnection = new VConnection("10.0.0.120", "sa", "sa")
conn.Open

' Open Project From VServer
Var projPath As FolderItem = GetFolderItem("femstest.vsp")
Var proj As VProject = new VProject(conn, projPath)

' Print Report into PDF
Var datasource as string = "mssql://host = '10.0.0.117' port = '1433' dbname = 'eios' user = 'eios' password = 'eios' timeout='10' datalimit='65535' "
Var query as String = "SELECT * FROM Event"
var report as VReport = proj.MakeNewReport("Report_Offer", datasource, query)
Var data as String = report.PrintToBuffer(EVReportPrintType.kToPDF, 1)

' Prepare file for download
Self.PDF = new WebFile
Self.PDF.mimetype = "application/pdf"
Self.PDF.FileName = "report.pdf"
Self.PDF.ForceDownload = FALSE
Self.PDF.Data = data

' Close Project and Connection
proj.Close
conn.Close

' Show PDF in Browser
GotoURL(Self.PDF.URL)

Exception err as VException
Var errNumber as Integer = err.ErrorNumber
Var errString as String = err.Message
End


The VServer log indicates that I successfully connect from my application to the VServer. The MSSQL datasource string is copied from the VStudio Schema Editor. I have no problem connecting to this MSSQL database from VStudio (and other tools) running on the same machine as my application. There isn't a firewall issue.

The VException error message I'm getting is: Error Number: 365829 - File "%S" is not open. The error occurs on the line "var report as VReport = proj.MakeNewReport("Report_Offer", datasource, query)".

I'm missing something simple here and any help or guidance is appreciated. Thank you.
Kommentar
There are no comments made yet.
Sergey Pashkov Akzeptierte Antwort
Hello James,

Open the project after creating an object:

Var proj As VProject = new VProject(conn, projPath)
proj.Open()
Kommentar
There are no comments made yet.
James Whitehead Akzeptierte Antwort
Sergey -

That's what I missed. Thank you for both the answer and your quick response. I really appreciate it!
Kommentar
There are no comments made yet.
  • Seite :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Categories

Announcements & News
  1. 0 subcategories
Valentina Studio
  1. 2 subcategories
Valentina Server
  1. 4 subcategories
Valentina Database ADK
  1. 0 subcategories
Valentina Reports ADK
  1. 0 subcategories
Other Discussions
  1. 2 subcategories
BETA Testing
  1. 0 subcategories
Education & Research
  1. 0 subcategories