Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. OracleClient

OracleClient

Scheduled Pinned Locked Moved C#
questiondatabaseoraclesysadminhelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    softty
    wrote on last edited by
    #1

    I am facing problem to connect oracle server with predefined datasource. Can anyone please tell me how can i create a connection with (ip address) , (orcale instance), (username) and (password). Please also provide me few lines of code, to update a table with using parameters. I attemted sql like "update set = ? where pk = ?", but it did not work at all. love2code

    L 1 Reply Last reply
    0
    • S softty

      I am facing problem to connect oracle server with predefined datasource. Can anyone please tell me how can i create a connection with (ip address) , (orcale instance), (username) and (password). Please also provide me few lines of code, to update a table with using parameters. I attemted sql like "update set = ? where pk = ?", but it did not work at all. love2code

      L Offline
      L Offline
      Luis Alonso Ramos
      wrote on last edited by
      #2

      I really did work very little with Oracle for one project, but if I remember correctly, you need to install some client software, and it's in that software that you set up the connection to the server. In you .NET code (using Oracle Data Provider) your connection string basically looks like this:

      Data Source=schema name;User Id=user name;Password=password"
      

      As you can see, no server information is there. As for the parameter question, its something like this:

      string sql = "UPDATE Table SET Field1 = :p_Field1 WHERE Field2 = :p_Field2";  // Note the colons to specify parameters
       
      OracleCommand cmd = new OracleCommand(sql, conn);
       
      cmd.Parameters.Add("p_Field1", someValue);  // Note that there is no colon
      cmd.Parameters.Add("p_Field2", someOtherValue);
       
      cmd.ExecuteNonQuery();
      

      I hope this helps a little. Good luck! -- LuisR


      Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!

      The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005

      S 1 Reply Last reply
      0
      • L Luis Alonso Ramos

        I really did work very little with Oracle for one project, but if I remember correctly, you need to install some client software, and it's in that software that you set up the connection to the server. In you .NET code (using Oracle Data Provider) your connection string basically looks like this:

        Data Source=schema name;User Id=user name;Password=password"
        

        As you can see, no server information is there. As for the parameter question, its something like this:

        string sql = "UPDATE Table SET Field1 = :p_Field1 WHERE Field2 = :p_Field2";  // Note the colons to specify parameters
         
        OracleCommand cmd = new OracleCommand(sql, conn);
         
        cmd.Parameters.Add("p_Field1", someValue);  // Note that there is no colon
        cmd.Parameters.Add("p_Field2", someOtherValue);
         
        cmd.ExecuteNonQuery();
        

        I hope this helps a little. Good luck! -- LuisR


        Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!

        The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005

        S Offline
        S Offline
        softty
        wrote on last edited by
        #3

        Thanks, Luis My parameters problem has been solved. But think those situation where my client machine has .net installted and oracle net client installed. When i run my program from that machine, it continues searching Oracle Server. My program does not know the Orcale [alias] or [data source] configured at that machine. Please provide me such Microsoft Solution. Thanks again. PK Biswas, India. love2code

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups