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. inserting new record in database

inserting new record in database

Scheduled Pinned Locked Moved Visual Basic
databaseannouncement
2 Posts 2 Posters 8 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    I am attempting to add a new record to a database (in this case Access) I have created a VB form with a textbox (txtName) to enter a new name and a command button to update the recordset by running a SQL statement by using an Insert Into command. The Insert Into statement requires a "values" parameter. I am trying to take the txtName.Text property and place it into the Values parameter. But it does not want to work this simply. Any input is welcome. thanks Craig

    K 1 Reply Last reply
    0
    • L Lost User

      I am attempting to add a new record to a database (in this case Access) I have created a VB form with a textbox (txtName) to enter a new name and a command button to update the recordset by running a SQL statement by using an Insert Into command. The Insert Into statement requires a "values" parameter. I am trying to take the txtName.Text property and place it into the Values parameter. But it does not want to work this simply. Any input is welcome. thanks Craig

      K Offline
      K Offline
      Konstantin Vasserman
      wrote on last edited by
      #2

      Your code could look something like that (providing you are using ADO): MyConnection.Open MyConnectionString MySQL = "INSERT INTO MyTable(MyField) VALUES('" & _ txtName.Text & "')" MyConnection.Execute MySQL MyConnection.Close I hope this helps.

      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