Thursday, August 4, 2016

Unexpected Error occurred in the Oracle Data Provider for .NET

While working with Oracle Data Provider with Visual studio you can get the following error:

The description for Event ID 0 from source devenv cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.
If the event originated on another computer, the display information had to be saved with the event.
The following information was included with the event:
An unexpected error occurred in the Oracle Data Provider for .NET.  The data provider 'Oracle Data Provider for .NET' failed to load.  The {18147ff9-1f37-4425-865b-5066a33701de} service could not be found.
the message resource is present but the message is not found in the string/message table


Solution:


The simple solution to this problem is to check your "Server Explorer" in Visual Studio, remove all connections, and then restart Visual studio.

Hopefully your problem will be solved.

Thursday, April 7, 2016

iREPORT (Jasper Reports): Working with date and time

Date and time handling is slightly complex in all Programming Languages, since each area has different date/time format and each language has its own way of handling these objects. In iReport, many developers finds difficulty in formatting, treating date and time in day-to-day operations. I am listing here some of the useful tricks/methods to be used in iReport:


1. To get the current date and time:


new Date()


2. To get the current date only (Today in .Net):


 new Date( (new Date()).getYear(),(new Date()).getMonth(), (new Date()).getDate())


3. To check if a variable / date is null?:


$F{ThisDate} == null


4. In development, there arise some situations in which we have to use the current date if a date is null, then use a variable and assign it the following expression:


$F{ThisDate} == null ? new Date( (new Date()).getYear(),(new Date()).getMonth(), (new Date()).getDate()): $F{ThisDate}

5. To get the difference between two dates (including start and end date) in "No. of Days" unit:


(int) ((($F{OutTime}==null? (new Date( (new Date()).getYear(),(new Date()).getMonth(), (new Date()).getDate())).getTime(): (new Date($F{OutTime}.getYear(),$F{OutTime}.getMonth(), $F{OutTime}.getDate()).getTime())) - (new Date($F{InTime}.getYear(),$F{InTime}.getMonth(), $F{InTime}.getDate())).getTime())/ (1000 * 60 * 60 * 24))+1

where, getTime translates the date into milliseconds which allows to add subtract days.
To convert the result from milliseconds to days we divide the result by  (1000 * 60 * 60 * 24).
To include the start date in difference we added 1. In beginning of the expression, we used "(int)" to  cast the output to integer value.

I hope that the above information may be useful to you. Please feel free to comment, if you find any correction or you have a better solution.

Thanks!

Popular Posts