Skip to Content
0
Former Member
Oct 02, 2010 at 07:38 AM

CRVS2010 Beta - Report Table ConectionInfo Not Updated on x64 version.

56 Views

I have converted an existing app to use the new CR for VS2010, when I test the app on a x32 platform all seems well, however, using the same code on an x64 platform results in a "logon failed" error.

Below is the code I am using, basically copied from SAP website.

private class ApplyCrLogin
        {
            public ApplyCrLogin()
            {
                DbName = "";
                ServerName = "";
                UserId = "";
                PassWord = "";
            }

            public string DbName { private get; set; }
            public string ServerName { private get; set; }
            public string UserId { private get; set; }
            public string PassWord { private get; set; }
    
            public void ApplyInfo(ref ReportDocument rpt)
            {
                try
                {
                    var boConnectionInfo = new ConnectionInfo
                                                          {
                                                              ServerName = ServerName,
                                                              DatabaseName = DbName,
                                                              UserID = UserId,
                                                              Password = PassWord
                                                          };


                    // Modify the ConnectionInfo for all tables in the main report        
                    ModifyConnectionInfo(rpt.Database, boConnectionInfo);

                    // Modify the ConnectionInfo for all tables in all subreports
                    foreach (ReportDocument boSubreport in rpt.Subreports)
                    {
                        ModifyConnectionInfo(boSubreport.Database, boConnectionInfo);
                    }
                }
                catch (Exception error)
                {
                    ExceptionHandling.LogProblem(error);
                }
            }

            private static void ModifyConnectionInfo(Database boDatabase, ConnectionInfo boConnectionInfo)
            {
                // Loop through each Table in the Database and apply the changes
                foreach (Table boTable in boDatabase.Tables)
                {
                    var boTableLogOnInfo = (TableLogOnInfo)boTable.LogOnInfo.Clone();
                    boTableLogOnInfo.ConnectionInfo = boConnectionInfo;

                    boTable.ApplyLogOnInfo(boTableLogOnInfo);
                }
            }
        }

When I check the properties of the report, they do not change from the original set in the report design.