JS

Sunday, October 11, 2015

Connecting to an oracle database without installing an Oracle Client

To setup your website to use a tnsnames.ora file without having to install an Oracle Client:

Method 1:
  1. Put your tnsnames.ora file in the folder "C:\Windows\System32\inetsrv" (Or "C:\Windows\SysWOW64\inetsrv" if you have a 64-bit OS)
  2. do an IIS Restart (iisreset) or just recycle the application pool for the application.

Method 2:
  1. Create a folder where you would like to put your tnsnames.ora (for example c:\tnsnames)
  2. Add an environment variable (if you don't know how to add an environment variable, please search google) named TNS_ADMIN with the value of the path of the tnsnames folder (for our example "c:\tnsnames")
  3. Restart your machine to allow windows to see the new variable.
  4. Note: you may need to add Read Permissions on the tnsnames folder for the IIS application pool user to allow it to read the tnsnames.ora file
  5. Note 2: Anytime you change anything in the content or permissions or the tnsnames,ora file, you will need to do an IIS Restart (iisreset) to make sure that the IIS server reads the new file.

To use the Oracle Client in your website:
  1. First you will need to get the Oracle.ManagedDataAccess.dll file from an Oracle Client Installation, it's located in the "(OracleHome)\odp.net\managed\common" folder.
  2. Copy the file to your website's "bin" folder.
  3. In your website include the Oracle.ManagedDataAccess.Client namespace




Wednesday, February 22, 2012

Crystal Reports Missing Parameters

Some times I get the Missing Parameters error when trying to export a Crystal Report, I had everything set up correctly but the problem was that I set the report data source AFTER setting the parameter values, when I switched them the error went away. This example causes the error (Report only has 1 parameter ("Cycle") )
        report.SetParameterValue("Cycle", "20");
        report.SetDataSource(dsApplicants);
This example fixes the code above
        report.SetDataSource(dsApplicants);
        report.SetParameterValue("Cycle", "20");

Tuesday, July 19, 2011

A Crystal Report Bug For Arabic Text

When viewing Arabic text in a PDF generated from crystal reports, sometimes all the spaces in the text get replaced by a diacritic ( ً, َ, ُ, ...).

This is caused by using diacritics after the last letter of the word in the text itself. crystal report replaces all spaces in that font type with the first diacritic in that text. i.e. if a paragraph has a font type of tahoma and contains the diacritic ( ً ), then all the spaces in the paragraph will be replaced by that diacritic.

The only solution is to not use diacritics at all until this is bug is fixed.

Friday, July 8, 2011

Creating WCF Data Services and using the OData Protocol

In this post you will learn how to expose your database for external queries, and then using the OData ,Open Data, Protocol. In this exercise you will need to use VS2010 (Visual Studio 2010), and make sure you have .NET Framework 4.0 is installed.

First, you'll need to define the data model and create the data service, WCF Data Services support data models created by VS2010 that are based on the ADO.NET Entity Framework. To do that follow the steps in this article: How to: Create a Data Service Using an ADO.NET Entity Framework Data Source (WCF Data Services).

After creating the data service, you must confirm access to it, for testing purposes you can allow everyone to access it by adding this line of code in the InitializeService method of the service:



For more information about configuring access to the data service see Configuring the Data Service (WCF Data Services).

Assuming that you named your data service "northwind.svc" and configured the VS web development server to use port 12345, open your internet browser and enter this url in the address bar:



This will return the default service document which lists all the entity sets that the data service exposes. For more information see Accessing the Service from a Web Browser (WCF Data Services Quickstart).

To learn more about OData go to this site: http://www.odata.org/developers