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. Database & SysAdmin
  3. Database
  4. exception

exception

Scheduled Pinned Locked Moved Database
database
3 Posts 3 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.
  • T Offline
    T Offline
    Trustapple
    wrote on last edited by
    #1

    hi, i am getting an exception while inserting data into a ms access database in "da.Fill(ds);" "No value given for one or more required parameters." my code is like this DataSet ds = new DataSet(); try { openconnection(); cmd = new OleDbCommand(query, con); OleDbDataAdapter oda = new OleDbDataAdapter(query, con); //fill the DataTable oda.Fill(ds); closeconnection(); return ds.Tables[0]; } catch (Exception) { return ds.Tables[0]; } finally { closeconnection(); } thanks in advance j

    A M 2 Replies Last reply
    0
    • T Trustapple

      hi, i am getting an exception while inserting data into a ms access database in "da.Fill(ds);" "No value given for one or more required parameters." my code is like this DataSet ds = new DataSet(); try { openconnection(); cmd = new OleDbCommand(query, con); OleDbDataAdapter oda = new OleDbDataAdapter(query, con); //fill the DataTable oda.Fill(ds); closeconnection(); return ds.Tables[0]; } catch (Exception) { return ds.Tables[0]; } finally { closeconnection(); } thanks in advance j

      A Offline
      A Offline
      Andy_L_J
      wrote on last edited by
      #2

      Dont you need to specify a table name in the oda.Fill(ds,"SomeTable")?

      The Fanatical All Black Supporter - Kea Kaha

      1 Reply Last reply
      0
      • T Trustapple

        hi, i am getting an exception while inserting data into a ms access database in "da.Fill(ds);" "No value given for one or more required parameters." my code is like this DataSet ds = new DataSet(); try { openconnection(); cmd = new OleDbCommand(query, con); OleDbDataAdapter oda = new OleDbDataAdapter(query, con); //fill the DataTable oda.Fill(ds); closeconnection(); return ds.Tables[0]; } catch (Exception) { return ds.Tables[0]; } finally { closeconnection(); } thanks in advance j

        M Offline
        M Offline
        Mike Dimmick
        wrote on last edited by
        #3

        Firstly, you're attempting to fill a dataset with the results of a query, not insert data into a database with this code. Is that what you intended? Secondly, the cmd object is not used. I don't know if you intended this. Passing the query string to the data adapter's constructor causes it to construct its own command object for its SelectCommand property. You can pass your own command object by using the version of the constructor that takes an OleDbCommand object. I think the reason for the error is that the query string has one or more ? characters in it, indicating replaceable parameters, and you've not specified the values of those parameters. You'll need to use the command's Parameters collection for this.


        DoEvents: Generating unexpected recursion since 1991

        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