Search code examples
sql-server-cecrystal-reports-2010

Crystal Reports 13.0, SQL Server Compact 4.0 logon problems when running reports


http://jasonirwin.ca/2009/04/05/crystal-reports-and-sql-server-ce/

Hi, I know it is a real pain to integrate Crystal reports with SQL Server Compact 4.0. I tried the above approach(link) to create a crystal report using SQL Compact 4.0 as back end. It works like a charm on my development machine. This approach basically creates a link between the report and the SDF. I am able to see the correct report with data populated from the SDF. But the catch is when I install the app in a different computer. It asks for logon information when I run the reports as NewDataSet in Server field. But there is no server, database is a SQL compact file and sits in a folder. SDF is password protected. I tried putting the password in the logon screen. It fails. I can't find any information on this issue anywhere.

Has anyone encountered this problem? Do you have ideas to fix the logon problem? Please help.


Solution

  • If anybody looking for a solution. following is how I fixed it.

    ' Set the logon information for each table.
                    For Each table In rpt.Database.Tables
                        ' Get the TableLogOnInfo object.
                        logonInfo = table.LogOnInfo
                        logonInfo.ConnectionInfo.LogonProperties.Item(0).Value = Environment.CurrentDirectory & "\schema.xml"
                        logonInfo.ConnectionInfo.Password = "pass123"
                        ' Apply the connection information to the table.
                        table.ApplyLogOnInfo(logonInfo)
                    Next table