1. Stefania Georgiadi
  2. Valentina Reports ADK
  3. Monday, March 21 2016, 08:25 PM
  4.  Subscribe via email
How do I print a report from Xojo when the data / connection is on SQL Server?

For example the following code does not work (probably the VConnection constructor is not correct because in that line it hangs!):

mReport = New VReport
Dim mConnection As VConnection("(local)", "sa", "12345";)
mProject = New VProject(mConnection, pvProjectFile)
mReportName = pvReportName

Try
mProject.Open()
mReport = mProject.MakeNewReport(pvReportName, pvDataSource, pvQuery)
catch e as VException
dim errNumber as Integer = e.ErrorNumber
dim errString as String = e.Message
MsgBox "Report Error "+CStr(errNumber)+": "+errString
Self.Close()
Return False
end

Return True
Comment
There are no comments made yet.
Sergey Pashkov Accepted Answer
But it is a local project, right?
VServer is not used?
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 1
Stefania Georgiadi Accepted Answer
Yes Sergey it is...
VServer is not used. However, if I change the code to

mReport = New VReport
mProject = New VProject(pvProjectFile)
mReportName = pvReportName

it crashes in the second line (mProject = New VProject(pvProjectFile))

So how should I do it?
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 2
Sergey Pashkov Accepted Answer
VConnection is not used in that case.
And no need to call mReport = New VReport, it will be created by the project

Something like that:
Dim f As FolderItem = getFolderItem( pvProjectFile )
mProject = new VProject( f )
mProject.Open()
mReport = mProject.MakeNewReport( pvReportName, pvDataSource, pvQuery)
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 3
Stefania Georgiadi Accepted Answer
Thanks Sergey,

I will try it and let you know how it goes...
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 4
Stefania Georgiadi Accepted Answer
Hi Sergey,

The code :

mReport = New VReport
If not(pvProjectFolderItem .Exists()) Then
Break
End If
mProject = New VProject(pvProjectFolderItem )

crashes at the last command.

pvProjectFolderItem is an existing Valentina Studio Project (C:\usr\val\SQL Server VE_INV_RETAIL.vsp)
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 5
Sergey Pashkov Accepted Answer
Does it crash with some readable exception?

You have initialisation code at the start of application:
Valentina.InitReports("","","";)

and shutdown at the end:
Valentina.ShutdownReports
Right?

There should be a complete example installed, maybe it will also help
V4RB_6/Examples/VReport/GeneralOnSQLite/GeneralOnSQLite.xojo_binary_project
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 6
Stefania Georgiadi Accepted Answer
Oops!

You are right, I forgot that. Even though I had been using a previous version of Valentina Reports with Xojo...

Thank you very much.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 7
  • Page :
  • 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