Click here to Skip to main content
16,018,057 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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...

C#
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

Set False for EnableDatabaseLogonPrompt Property[^]

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

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900