Wednesday, March 16, 2011

Instant Oracle Using C#

I’m amazed that people actually find the time to blog. I set this blog site up 2 or 3 weeks ago, have plenty of code to blog about but have been busy coding at my day job (and sometimes night job) that I haven’t had much time at all to even think about this.

Anyhow, the topic is about Oracle & C#, not my daily work load. I wrote up this article several years ago, when I actually did have more time and it’s apparently still getting plenty of good use today.

You can view the article here at codeproject.com: Instant Oracle Using C#

I myself haven’t worked with Oracle databases for quite some time, but if you find you need to this article will help you get a project started.

Enjoy :)

2 comments:

  1. As you said in Codeproject I have tried to include reference for oracleclient.dll but I failed. Do i need to repair .Net framework?
    I have separately downloaded the oracleclient.dll. Working on it.
    I'm new to C#. Basically I'm a C++ programmer in Linux (Native C++ and QT) as well as Windows(Qt). So Environment suffocation is little bit high.

    ReplyDelete
  2. I have sorted it! Its very simple thing
    1) You need to include "System.Data.OracleClient.dll" from "C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Data.OracleClient.dll"
    2) You will get Error when you build as
    "The type or namespace name 'OracleClient' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)"
    So you need to change Properties->Application->Target FrameWork
    as ".NET framework 4" instead of ".NET framework 4 Client"
    3) Then You can build with out errors and run the program, But (a big 'BUT') You will encounter a exception As
    " Attempt to load Oracle client libraries threw BadImageFormatException. This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed."
    Then you need to stop running and Properties->Build->Platform Target to "Any CPU"
    Everything will work fine.
    Cheers!

    ReplyDelete