I have a Delphi 5 application working against an SQL Server back-end. The user is able to select to connect to one of a number of databases on the server (databases have identical structures).
I am now trying to dynamically set the source for the Crystal Report through code. The designed report works successfully using the SQL Server designed on but when I try to connect to a different server I have problems.
I am using syntax as follows :
CRReport := Application1.OpenReport(tpRptPath, 1);
Application1.LogOnServer('p2sodbc.dll', 'SERVER-NAME', 'DATABASE-NAME', 'user-name', 'password');
This generates the error message "Server has not yet been opened."
What instruction do I need to call first ?
I have tried an alternate approach by dynamically setting the SQL query string for the report using code :
CRReport.Set_SQLQueryString('SELECT ...
FROM [SERVER-NAME].[DATABASE-NAME].dbo.TABLE-NAME
WHERE ....');
On running this I am given the errors :
"General SQL Server Error. Check messages from the SQL Server."
"Error detected by database DLL."
What am I doing wrong ?
I am now trying to dynamically set the source for the Crystal Report through code. The designed report works successfully using the SQL Server designed on but when I try to connect to a different server I have problems.
I am using syntax as follows :
CRReport := Application1.OpenReport(tpRptPath, 1);
Application1.LogOnServer('p2sodbc.dll', 'SERVER-NAME', 'DATABASE-NAME', 'user-name', 'password');
This generates the error message "Server has not yet been opened."
What instruction do I need to call first ?
I have tried an alternate approach by dynamically setting the SQL query string for the report using code :
CRReport.Set_SQLQueryString('SELECT ...
FROM [SERVER-NAME].[DATABASE-NAME].dbo.TABLE-NAME
WHERE ....');
On running this I am given the errors :
"General SQL Server Error. Check messages from the SQL Server."
"Error detected by database DLL."
What am I doing wrong ?