Click here to Skip to main content
14,643,383 members
Rate this:
Please Sign up or sign in to vote.
See more:
HI everyone,

Ever since I learnt to use crystal reports, I have been facing the problem that (after deployment on client machine), Crystal report asks for Database Login... specially it shows a faded blank in place of Database: textbox. Even I supply the database information before calling the crystal report.. using a function like this... but still It is giving me the same trouble. Please help...

private void SetLogon(ReportDocument rptDocumentObject, string strReportPathtoLoad)
       {

           TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
           TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
           ConnectionInfo crConnectionInfo = new ConnectionInfo();
           Tables CrTables;

           rptDocumentObject.Load(strReportPathtoLoad);

           crConnectionInfo.ServerName = ConnectionModule.IP;   // giving Servername
           crConnectionInfo.DatabaseName = ConnectionModule.DBName; //Giving Databasename
           crConnectionInfo.UserID = ConnectionModule.Uid; //Giving Login ID
           crConnectionInfo.Password = ConnectionModule.Pwd; //Giving Password

           CrTables = rptDocumentObject.Database.Tables;
           foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
           {
               crtableLogoninfo = CrTable.LogOnInfo;
               crtableLogoninfo.ConnectionInfo = crConnectionInfo;
               CrTable.ApplyLogOnInfo(crtableLogoninfo);
           }
       }
Posted

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Set False for EnableDatabaseLogonPrompt Property[^]

Move your code from Page_Load() to Page_Init() Past answer[^]
Also check this one[^] for additional work out.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100