I am working on ASP.NET web application to retrieve a data from oracle database via C# that has been retrieved successfully,
ِAbout a week ago,I found out the format of retrieving data has been changed, and the web application raises unexpected behavior although I didn’t change any thing in my code.
This might occurred if NLS_LANGUAGE Oracle Parameter has been changed from AMERICAN to ARABIC
To overcome this issue you should set NLS_LANGUAGE in code manually by following the bit steps below :
Open Visual Studio > Open existing ASP.NET Solution > Make sure that Oracle.DataAccess.Client reference has been added.
Using Oracle.DataAccess.Client ;
After opening the connection to database, Add the following bold code.
Oracle.DataAccess.Client.OracleConnection mConnection = new Oracle.DataAccess.Client.OracleConnection(OracleConn); mConnection.Open(); var si = mConnection.GetSessionInfo(); si.Language = "AMERICAN"; // for English or ARABIC for Arabic mConnection.SetSessionInfo(si);
The previous code should allow you to set a NLS_LANGUAGE based on your requirement.
- Download and install Oracle Client.
- Configure Oracle Connection string and tnsnames.ora file.
- Retrieve a BLOB field from Oracle database side and show it in ASP.NET page.