Article ID 1907 Article Title ERROR: "Unable to connect: incorrect log on parameters" Article URL http://www.dataaccess.com/kbasepublic/kbprint.asp?ArticleID=1907 KBase Category Crystal Reports Date Created 10/30/2003 Last Edit Date 05/18/2005
Article Text
PROBLEM:
The error "Logon failed" was being displayed in Crystal Designer for one of my reports. Having the location of the files set to "same as report" Crystal changed the path to the files to .\<filename>
After making that change, running the report from the Designer was OK but when trying to run the same report from VDF (from a report view) it seems like the data files are searched for in the current directory instead of in the data dir, i.e. where the report (RPT) is. I copied the data files to the Programs directory and the error was still displayed if the current path was not set to the data path...
If the current directory is not set to the Data directory of the workspace, the report does not run, it gives the following error:
Crystal report error. Error in File <path\<name of rpt file>:
Unable to connect: incorrect log on parameters.
where <path\<name of rpt file> could be C:\Visual DataFlex 9.0\Examples\Sample Applications\Order\Data\Test1.rpt
If the current directory is set in the program, the report runs fine. Also, if the path to the files is saved in the report, the report runs fine.
How can I correct this?
SOLUTION:
The way to avoid this problem is to manually change the location of the tables in Crystal Designer and remove .\ from the name of the tables:
1- Open the report in Crystal Designer
2- Select Database | Set Datasource Location
3- On the Current Data Source panel, expand Properties under the file name
4- Click on "Data File: <filename>.dat" to highlight it
5- Press F2 to edit the file name -- remove .\ from the name
6- Press Enter
Repeat steps 3 through 6 for each file included in the report. Then close the Set Datasource Location dialog and save the report. You should be able to run the report from both Visual DataFlex and Crystal without errors.
You can also add the following line to the OnInitializeReport method of your program:
Procedure OnInitializeReport
String sDataPath
Get psDataPath Of (phoWorkspace(ghoApplication)) To sDataPath
Get PathAtIndex Of (phoWorkspace(ghoApplication)) sDataPath 1 To sDataPath
Set Report_Data_Path To sDataPath
:
:
End_Procedure
Contributed By:
Ulbe Stellema
Company: Data Access Worldwide
email: ulbe.stellema@dataaccess.eu
Web Site: http://www.dataaccess.eu
Links Related to this Article
DAW Knowledge Base article 2122: HOWTO: Set Data File Location to 'Same as Report' using Crystal 10
Email this Article
Email this Article to a Colleague
Send Feedback on this Article to Data Access Worldwide
Copyright ©2024 Data Access Corporation. All rights reserved.
The information provided in the Data Access Technical Knowledge Base is provided "as is" without warranty of any kind. Data Access Corporation disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. In no event shall Data Access Corporation or its suppliers be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if Data Access Corporation or its suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply.