PDA

View Full Version : Visual Report Writer x Crystal Reports



sandrobrz
22-Jul-2010, 08:49 AM
New tools, old problems.


VDF 15.1 + Sql server + driver da mertech

We all know that DataFlex to access tables that are not native to your database uses the files int.
Well, within these files INT I omit the server information and password, they are reported to the application at runtime.

And thus do not have to be changing the files INT, when I need to access a server or another.

When developing reports in Crystal, wearing your own connector to the database sql server, and run-time changed the password and sql server.

As in routine below.


Procedure OnInitializeReport Handle hoReport

Handle[] hoTables
Handle hoDatabaseTable hoDatabase
Integer iTableItem iTableCount
Boolean bOK

Forward Send OnInitializeReport hoReport

Get DatabaseObject of hoReport to hoDatabase
If (hoDatabase) Begin
Get TableObjects of hoDatabase to hoTables
Move (SizeOfArray(hoTables)) to iTableCount
For iTableItem from 0 to (iTableCount -1)
Move hoTables[iTableItem] to hoDatabaseTable
If (hoDatabaseTable) Begin
// set the same password for all the tables in the ADO datasource
Get SetPassword hoDatabaseTable senha_sql to bOK
Get SetServer hoDatabaseTable servidor_sql to bOK
End
Loop
End

end_procedure

The big question, how in VRW, since I'm using as if it were based DataFlex (since it opens through int), thus gain the relationships of tables that already have the project in VDF.

The only way I managed to beat done is put the username, password and the file server INT.
What I want to avoid because it creates a terrible security hole.

Peter van Mil
22-Jul-2010, 09:26 AM
A pragmatic solution is to use connection ID's.

In MSSQLDRV.INT:



DFConnectionId ExactGlobe, SERVER=.\SQLEXPRESS;Trusted_Connection=yes;DATABAS E=ExactGlobe, 0


In .INT files:



DRIVER_NAME MSSQLDRV
SERVER_NAME DFCONNID=ExactGlobe
DATABASE_NAME ItemNumbers
SCHEMA_NAME dbo


With a trusted connection the rights are given by the Active Directory and the .INT files don't contain passwords.

Vincent Oorsprong
25-Jul-2010, 03:28 AM
Sandro,

For speed it is not recommended to access your non-embedded database tables via INT files in Visual Report Writer. You better use the ODBC connection.

When you want to use INT files the INT file must give all the login information for Visual Report Writer to access the table in the database. This can be in the INT file directly or as Peter says via a connectionid. I am not sure how this can be/is done when using the Mertech drivers, but as said you should look into the ODBC way instead of the INT way.