Writing Code
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Writing Code
Message Icon Topic: Login prompt from one machine but not another Post Reply Post New Topic
Author Message
tbplayer22
Newbie
Newbie


Joined: 29 Jan 2010
Location: United States
Online Status: Offline
Posts: 1
Quote tbplayer22 Replybullet Topic: Login prompt from one machine but not another
    Posted: 29 Jan 2010 at 9:18am
My first post here.  I posted this question over in the ASP.NET forums that I usually frequent, but no one has been able to help me out.  I ran across this site and thought perfect maybe there will be experts over here for my peculiar problem.  Anyway here is the run down. 

I've made a windows form project with Crystal Reports.  I have two machines one which I was working on and one which I was testing from.  The one I was working the project on has Visual Studio 2008 loaded.  The one I was testing from at one time has VS 2008 loaded, but no longer has it.  When I originally deployed my ClickOnce package I was not including "Crystal Reports Basic for Visual Studio 2008" in the package, but it didn't matter for my test machine.  It still ran fine.  It wasn't until I went to a 3rd machine when I started getting errors when trying to access a Crystal Report.


I was able to realize that I needed to have "Crystal Reports Basic for Visual Studio" included in the prerequisite components.  Once I chose this option the 3rd machine then was able to view the Crystal Reports, but a new issue came up.  On this third machine now a database login prompt displays.  This was not an issue with the 2nd machine that I was originally used for testing, but that 2nd machine at one time had VS 2008 loaded. 

The code for the report is to use integrated security.  So once again I code from machine 1 and debug mode it runs fine.  I installed the application with ClickOnce on machine 2 which once had VS 2008 installed, but no longer has VS 2008 installed and the Crystal Reports run fine.  I installed on a 3rd machine that never had any version of Visual Studio installed on it and I can view the Crystal Viewer, but now it is asking for a SQL server login prompt.    I am going to include the code below.  Any advise would be greatly appreciated. 


  1. public Z()  
  2.         {  
  3.             InitializeComponent();  
  4.   
  5.             ReportDocument cryRpt = new ReportDocument();  
  6.             string RPTlocation = Constants.GetRPTlocation().ToString();  
  7.             cryRpt.Load(@RPTlocation + "z.rpt");  
  8.             //between coments was added to make database connection dynamic  
  9.             /////////////////////////////////////////////////////////////////  
  10.             TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();  
  11.             TableLogOnInfo crtableLogininfo = new TableLogOnInfo();  
  12.             ConnectionInfo crConnectionInfo = new ConnectionInfo();  
  13.             Tables CrTables;  
  14.             //////////////////////////////////////////////////////////////////  
  15.   
  16.               
  17.   
  18.             //between coments was added to make database connection dynamic  
  19.             //////////////////////////////////////////////////////////////////  
  20.             crConnectionInfo.ServerName = Constants.DevOrProduction.ToString() + "\\sql2";  
  21.             crConnectionInfo.DatabaseName = "Z";   
  22.             crConnectionInfo.IntegratedSecurity = true;  
  23.             CrTables = cryRpt.Database.Tables;  
  24.             foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)  
  25.             {  
  26.                 crtableLogininfo = CrTable.LogOnInfo;  
  27.                 crtableLogininfo.ConnectionInfo = crConnectionInfo;  
  28.                 CrTable.ApplyLogOnInfo(crtableLogininfo);  
  29.             }  
  30.             ///////////////////////////////////////////////////////////////////  
  31.   
  32.             // Create parameter objects  
  33.             ParameterFields myParams = new ParameterFields();  
  34.             ParameterField myParam = new ParameterField();  
  35.             ParameterField myParam2 = new ParameterField();  
  36.             ParameterDiscreteValue myDiscreteValue = new ParameterDiscreteValue();  
  37.   
  38.             // Set the ParameterFieldName to the name of the parameter  
  39.             // created in the Field Explorer  
  40.             myParam.ParameterFieldName = "mydate";  
  41.   
  42.             // Add discrete values for the date  
  43.             DateTime mydate2 = DateTime.Parse(Constants.mydate);  
  44.             myDiscreteValue.Value = mydate2;  
  45.             myParam.CurrentValues.Add(myDiscreteValue);  
  46.   
  47.             // Add param object to params collection  
  48.             myParams.Add(myParam);  
  49.   
  50.             // Assign the params collection to the report viewer  
  51.             crystalReportViewer1.ParameterFieldInfo = myParams;  
  52.               
  53.             // Assign the Report to the report viewer.  
  54.             crystalReportViewer1.ReportSource = cryRpt;  
  55.             //crystalReportViewer1.Refresh();  
  56. //TRIED WITH ABOVE REFRESH ON AND OFF, MAKES NO DIFFERENCE  
  57. //SAME DB LOGIN PROMPT  
  58.   
  59.             this.WindowState = FormWindowState.Maximized;  
  60.             Constants.mydate = null;  
  61.         } 

IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.