1

I'm using window 10, VN.NET 2015 with Crystal Report and Oracle 11g at PC-A, Windows 10, Oracle 11g at Pc-B.

I published the installation package and run on PC-B and it is working fine, connected with database but the report is not working and I received the message:

the type initializer for 'crystaldecisions.shared.sharedutils' threw an exception

These are the dll.deploy files included in the application files folder:

enter image description here

Please let me know how I can fix this problem.

enter image description here

project data

My Connection

Updated

connection code

New One

Ajay2707
  • 5,690
  • 6
  • 40
  • 58
  • this file may be not deploy, to check go to in the project, then just search this dll used or if not found then search in the code this dll name where you will find the reference via Using keyword at the top in the page – Ajay2707 Mar 08 '19 at 16:57
  • i have this file "CrystalDecisions.Shared.dll" in "\bin\Debug" and "CrystalDecisions.Shared.dll.deploy" in "Application Files" but i i don't have "crystaldecisions.shared.sharedutils" file , ..... – Ejaz Sarwar Mar 11 '19 at 06:26
  • that will be the namespace which is in this dll. Just check these link :https://stackoverflow.com/questions/12374681/the-type-initializer-for-crystaldecisions-shared-sharedutils-threw-an-exceptio, https://www.codeproject.com/Questions/417334/Issue-related-to-Crystal-Reports, – Ajay2707 Mar 11 '19 at 09:00
  • I installed "CRRuntime_32bit_13_0_22" then issue resolved .. but now i have another issue .... when i run report i got this msg "crystal window form viewer" ----"Failed to load database information" – Ejaz Sarwar Mar 12 '19 at 05:59
  • ok, so for this, just try to connect db from your report in local pc. and reply that Are you able to do this? – Ajay2707 Mar 12 '19 at 06:52
  • yes i can connect and run all reports on my local pc (development PC) and also only one report is running on client pc but other reports giving the same msg ... – Ejaz Sarwar Mar 12 '19 at 06:57
  • which one that you just checked right now. – Ajay2707 Mar 12 '19 at 06:58
  • i just found one difference , the report ruining on client Pc , have connection "database Expert --- project data --- DataSet1, and the other reports which msg "crystal window form viewer" ----"Failed to load database information" have have connection "database Expert --- My Connection --- Sureguide" ,... i think this is the problem ??? how i can resolve this ?? – Ejaz Sarwar Mar 12 '19 at 07:37
  • yes, by default whatever credential you gave while creating CR, its preserve with the connection string. When you publish or run on another machine, its try to access DB based on credential preserve and if not able to access, then its throw above error – Ajay2707 Mar 12 '19 at 08:14
  • you can check that how to set credentials : https://stackoverflow.com/questions/23255835/crystal-report-viewer-not-accepting-login-info – Ajay2707 Mar 12 '19 at 08:20
  • the report is running is this didn't set credentials at report level , i just add data set in project and have connection "database Expert --- project data --- DataSet1, the only difference i found in report .... "database Expert --- My Connection --- Sureguide" not ruining .... database Expert --- project data --- DataSet1, running – Ejaz Sarwar Mar 12 '19 at 10:09
  • are you solved the issue – Ajay2707 Mar 14 '19 at 05:06

1 Answers1

0

Just add in your code for credential code and for the actual credential value you will set in your web.config/app.config file. and after that publish and deploy with new credentials which CR automatically update it at runtime.

ConnectionInfo crconnectioninfo = new ConnectionInfo();
    ReportDocument cryrpt = new ReportDocument();
    TableLogOnInfos crtablelogoninfos = new TableLogOnInfos();
    TableLogOnInfo crtablelogoninfo = new TableLogOnInfo();

    Tables CrTables;

    crconnectioninfo.ServerName = "localhost";
    crconnectioninfo.DatabaseName = "dbclients";
    crconnectioninfo.UserID = "ssssssss";
    crconnectioninfo.Password = "xxxxxxx";  

Check this links : How to set database login infos (connection info) for crystal report?

How to stop crystal report viewer from asking login credentials when opening subreport

Ajay2707
  • 5,690
  • 6
  • 40
  • 58
  • this code not working .... i can't understand why my one report running without any credential value ??? – Ejaz Sarwar Mar 12 '19 at 11:45
  • I written above just see – Ajay2707 Mar 13 '19 at 05:21
  • this code not working with vb.net 2015 -- giving me error , can you plz verify your code. – Ejaz Sarwar Mar 13 '19 at 11:25
  • i have a connection name "sgcnn" in my main module and call the connect at the form where report run .... now i tried to copy your code "sgcnn.ServerName" but its not there .... – Ejaz Sarwar Mar 13 '19 at 11:55
  • if the dll is not there when you get error, just ctrl+spacebar which suggest to include namespace and add it (this is only happened when dll added in your project), other wise add dll which is required. In my case I added 4or 5 CR dll in which one of them have this functionality to add db credentials and connection string. I will check that dll – Ajay2707 Mar 13 '19 at 13:12
  • the error shows that variable not define, just declare as in the my code ConnectionInfo crconnectioninfo = new ConnectionInfo(); and still you get error for "ConnectionInfo" , then add dll which automatically .net suggest when you mouse over on the "ConnectionInfo" – Ajay2707 Mar 14 '19 at 08:35
  • i just add "new one" coding screen plz see, i did this still have little issue or some thing missing .... – Ejaz Sarwar Mar 14 '19 at 09:26
  • Hi @EjazSarwar, that is not required, if you see my first link in the answer. That is required when you have multiple tables rather than stored procedure. Ideally its not required, just check without that variable. – Ajay2707 Mar 14 '19 at 10:43