Hello,
I have a problem with setting a connect string in frxSDACDatabase object.
When I design report I've got a connect string for my local database and ShowReport works ok, but when I send this report to my clients there is neccesary to set a connect string to MSConnection.ConnectString.
I've got a frxSDACComponents1.DefaultDatabase set on MSConnection, but when FastReport.ShowReport is called, a FastReport tried to connect to my local database.
Is it possible to set this connection string just before method FastReport.ShowReport ? I tried to set this string when OnStartReport is called, but it is to late.
kind regards
Zbigniew Sorokowski
connect string in frxSDACDatabase just before ShowReport (FastReport 3)
thank you for your answer, but the problem is that I have to set 2 connection strings - one is MSConnection and I have it in DataModule/Delphi - and with this connection I haven't got any problems.
Second connection is directly in filereport.fr3 - I mean frxSDACDatabase.
I try to something like this (on client side):
ShowMessage(DataModule.MSConnection1.ConnectString); // here I see proper client connect string, I'm connected to database
FastReport.LoadFromFile('filereport.fr3'); -> in this file I have frxSDACDatabase object with my local properties like server, user and so on. When I prepare this fr3 file on my side I don't know how it has to be set on client side
FastReport.ShowReport; // here I have error message 'SQL Network Interfaces: Error locating Server/Instance Specified' because frxSDACDatabase try to connect to my locale database
My problem is - how to do this:
frxSDACDatabase.Server := DataModule.MSConnection1.Server
...
just before
FastReport.ShowReport;
I thought that it is enough to set
frxSDACComponents1.DefaultDatabase := DataModule.MSConnection1
but it isn't.
Maybe I do something wrong, but I couldn't find any manual which describe this subject - on this forum and FastReport either.
ZS
Second connection is directly in filereport.fr3 - I mean frxSDACDatabase.
I try to something like this (on client side):
ShowMessage(DataModule.MSConnection1.ConnectString); // here I see proper client connect string, I'm connected to database
FastReport.LoadFromFile('filereport.fr3'); -> in this file I have frxSDACDatabase object with my local properties like server, user and so on. When I prepare this fr3 file on my side I don't know how it has to be set on client side
FastReport.ShowReport; // here I have error message 'SQL Network Interfaces: Error locating Server/Instance Specified' because frxSDACDatabase try to connect to my locale database
My problem is - how to do this:
frxSDACDatabase.Server := DataModule.MSConnection1.Server
...
just before
FastReport.ShowReport;
I thought that it is enough to set
frxSDACComponents1.DefaultDatabase := DataModule.MSConnection1
but it isn't.
Maybe I do something wrong, but I couldn't find any manual which describe this subject - on this forum and FastReport either.
ZS
You can try to remove the frxSDACDatabase from your report and put the following line of your code just before you call to FastReport.ShowReport:
In this case DataModule.MSConnection1 should be caught by your FastReport.
Code: Select all
frxSDACComponents1.DefaultDatabase := DataModule.MSConnection1;