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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. ORA-01008: not all variables bound - ADO.NET

ORA-01008: not all variables bound - ADO.NET

Scheduled Pinned Locked Moved Database
helpcsharpdatabase
4 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
    sri_con3
    wrote on last edited by
    #1

    Hi, I am facing problems with the Sub Query parameter injecting problem. Let me give u the code so tat u can understand the prob String strSQL = “select d.deptno,e.empname from dept d, (select empname from emp where hdate = : inputDate and jdate= : inputDate) e”; OralcConnection con = new OracleConnection(conString); OracleCommand cmd = new OracleCommand(strSQL,con); OracleDataReader dr; cmd.CommandType = CommandType.Text; cmd.Parameter.Add(“:inputDate”,”01/01/2006”); dr = cmd.ExecuteReader(); but when ever i run this code its saying tat ORA-01008: not all variables bound. If I add other parameter to the CommandObject with same name and value its working fine. But I need to add only one parameter to this CommandObject. Please help out sri

    sri

    J 1 Reply Last reply
    0
    • S sri_con3

      Hi, I am facing problems with the Sub Query parameter injecting problem. Let me give u the code so tat u can understand the prob String strSQL = “select d.deptno,e.empname from dept d, (select empname from emp where hdate = : inputDate and jdate= : inputDate) e”; OralcConnection con = new OracleConnection(conString); OracleCommand cmd = new OracleCommand(strSQL,con); OracleDataReader dr; cmd.CommandType = CommandType.Text; cmd.Parameter.Add(“:inputDate”,”01/01/2006”); dr = cmd.ExecuteReader(); but when ever i run this code its saying tat ORA-01008: not all variables bound. If I add other parameter to the CommandObject with same name and value its working fine. But I need to add only one parameter to this CommandObject. Please help out sri

      sri

      J Offline
      J Offline
      Jim Conigliaro
      wrote on last edited by
      #2

      Try adding the parameter without the colon ... cmd.Parameter.Add(“inputDate”,”01/01/2006”); Also, I don't know if it is a formatting issue with your post, but in your query, you appear to have a space between the colon and the variable name.

      Jim Conigliaro jconigliaro@ieee.org
      http://www.jimconigliaro.com

      S 1 Reply Last reply
      0
      • J Jim Conigliaro

        Try adding the parameter without the colon ... cmd.Parameter.Add(“inputDate”,”01/01/2006”); Also, I don't know if it is a formatting issue with your post, but in your query, you appear to have a space between the colon and the variable name.

        Jim Conigliaro jconigliaro@ieee.org
        http://www.jimconigliaro.com

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

        Hi Jim, thanks for your response, i traied that process also but still i its giving the same error. is there any thing i am missing in my code. please help me out.

        sri

        S 1 Reply Last reply
        0
        • S sri_con3

          Hi Jim, thanks for your response, i traied that process also but still i its giving the same error. is there any thing i am missing in my code. please help me out.

          sri

          S Offline
          S Offline
          sri_con3
          wrote on last edited by
          #4

          Hi, I got the solution we have to just mention the binding type dbCmd.BindByName = true; then it will take only two parameters

          sri

          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