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. Visual Basic
  4. Update Table gets message "parameter has no default value"

Update Table gets message "parameter has no default value"

Scheduled Pinned Locked Moved Visual Basic
helpagentic-aiquestionannouncement
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.
  • K Offline
    K Offline
    keninfo
    wrote on last edited by
    #1

    Hello all, I am cracking my brains for two weeks now on the following problem: I have to update records on a table but i am now in the stiuation that i get the message "parameter @NummerNaam has no default value" I have posted this question once, thanks for the tips. I also read several documentation but still get stuck. Below my code. Thanks, Bas Dim command As System.Data.OleDb.OleDbCommand = New System.Data.OleDb.OleDbCommand("Update Agent" & _ " SET Nummer_Naam = @NummerNaam, Agentnummer = @AgentNummer, Agentnaam = @AgentNaam" & _ " WHERE(Agentnummer = @agentNummerOud)", dcAgent) command.Parameters.Add("@NummerNaam", OleDb.OleDbType.VarChar, 20, "Nummer_Naam") command.Parameters.Add("@AgentNummer", OleDb.OleDbType.Integer, 10, "Agentnummer") command.Parameters.Add("@AgentNaam", OleDb.OleDbType.VarChar, 20, "Agentnaam") Dim parameter As System.Data.OleDb.OleDbParameter = command.Parameters.Add( _ "@agentNummerOud", OleDb.OleDbType.Integer, 10, agentNummerOud) parameter.SourceVersion = DataRowVersion.Original command.Connection.Open() command.ExecuteNonQuery() command.Connection.Close()

    D 1 Reply Last reply
    0
    • K keninfo

      Hello all, I am cracking my brains for two weeks now on the following problem: I have to update records on a table but i am now in the stiuation that i get the message "parameter @NummerNaam has no default value" I have posted this question once, thanks for the tips. I also read several documentation but still get stuck. Below my code. Thanks, Bas Dim command As System.Data.OleDb.OleDbCommand = New System.Data.OleDb.OleDbCommand("Update Agent" & _ " SET Nummer_Naam = @NummerNaam, Agentnummer = @AgentNummer, Agentnaam = @AgentNaam" & _ " WHERE(Agentnummer = @agentNummerOud)", dcAgent) command.Parameters.Add("@NummerNaam", OleDb.OleDbType.VarChar, 20, "Nummer_Naam") command.Parameters.Add("@AgentNummer", OleDb.OleDbType.Integer, 10, "Agentnummer") command.Parameters.Add("@AgentNaam", OleDb.OleDbType.VarChar, 20, "Agentnaam") Dim parameter As System.Data.OleDb.OleDbParameter = command.Parameters.Add( _ "@agentNummerOud", OleDb.OleDbType.Integer, 10, agentNummerOud) parameter.SourceVersion = DataRowVersion.Original command.Connection.Open() command.ExecuteNonQuery() command.Connection.Close()

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      You created four parameter objects, but you didn't assign values to any of the parameters. You can change that by doing something like this:

      command.Parameters.Add(new OleDbParameter("@NummerNaam", OleDb.OleDbType.VarChar, 20, "Nummer_Naam")).Value = somevalue
      command.Parameters.Add(new OleDbParameter("@AgentNummer", OleDb.OleDbType.Integer, 10, "Agentnummer").Value = somevalue
      command.Parameters.Add(new OleDbParameter("@AgentNaam", OleDb.OleDbType.VarChar, 20, "Agentnaam").Value = somevalue

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007

      K 2 Replies Last reply
      0
      • D Dave Kreskowiak

        You created four parameter objects, but you didn't assign values to any of the parameters. You can change that by doing something like this:

        command.Parameters.Add(new OleDbParameter("@NummerNaam", OleDb.OleDbType.VarChar, 20, "Nummer_Naam")).Value = somevalue
        command.Parameters.Add(new OleDbParameter("@AgentNummer", OleDb.OleDbType.Integer, 10, "Agentnummer").Value = somevalue
        command.Parameters.Add(new OleDbParameter("@AgentNaam", OleDb.OleDbType.VarChar, 20, "Agentnaam").Value = somevalue

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007

        K Offline
        K Offline
        keninfo
        wrote on last edited by
        #3

        Hello Dave, Thanks for the tip. Now i get it. I wil try this.

        1 Reply Last reply
        0
        • D Dave Kreskowiak

          You created four parameter objects, but you didn't assign values to any of the parameters. You can change that by doing something like this:

          command.Parameters.Add(new OleDbParameter("@NummerNaam", OleDb.OleDbType.VarChar, 20, "Nummer_Naam")).Value = somevalue
          command.Parameters.Add(new OleDbParameter("@AgentNummer", OleDb.OleDbType.Integer, 10, "Agentnummer").Value = somevalue
          command.Parameters.Add(new OleDbParameter("@AgentNaam", OleDb.OleDbType.VarChar, 20, "Agentnaam").Value = somevalue

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007

          K Offline
          K Offline
          keninfo
          wrote on last edited by
          #4

          Hello Dave, I tried, it works fantastic. Thanks guru!!

          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