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. VB.NET/MS ACCESS Fill column and all entries in the that column with the current date

VB.NET/MS ACCESS Fill column and all entries in the that column with the current date

Scheduled Pinned Locked Moved Visual Basic
csharpmysqltutorialannouncement
8 Posts 4 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.
  • U Offline
    U Offline
    User 11833437
    wrote on last edited by
    #1

    I want to fill all the entries in a column with the current date so that I can compare it to a DateofTest column and determine how many days since the last test. I think I can figure out the number of days but I can't figure out how to fill the column with the current date.

    Private Sub Reports_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
    mySql = "Update Studentdata, SET currentDate = Date()"
    ConnDB()
    myCommand = New OleDbCommand(mySql, myConnection)

    End Sub

    Z L 2 Replies Last reply
    0
    • U User 11833437

      I want to fill all the entries in a column with the current date so that I can compare it to a DateofTest column and determine how many days since the last test. I think I can figure out the number of days but I can't figure out how to fill the column with the current date.

      Private Sub Reports_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
      mySql = "Update Studentdata, SET currentDate = Date()"
      ConnDB()
      myCommand = New OleDbCommand(mySql, myConnection)

      End Sub

      Z Offline
      Z Offline
      ZurdoDev
      wrote on last edited by
      #2

      Remove the comma.

      UPDATE StudentData SET currentDate = DATE()"

      Social Media - A platform that makes it easier for the crazies to find each other. Everyone is born right handed. Only the strongest overcome it. Fight for left-handed rights and hand equality.

      U 1 Reply Last reply
      0
      • Z ZurdoDev

        Remove the comma.

        UPDATE StudentData SET currentDate = DATE()"

        Social Media - A platform that makes it easier for the crazies to find each other. Everyone is born right handed. Only the strongest overcome it. Fight for left-handed rights and hand equality.

        U Offline
        U Offline
        User 11833437
        wrote on last edited by
        #3

        No luck. I don't get an error it just doesn't do anything to the column.

        Z 1 Reply Last reply
        0
        • U User 11833437

          I want to fill all the entries in a column with the current date so that I can compare it to a DateofTest column and determine how many days since the last test. I think I can figure out the number of days but I can't figure out how to fill the column with the current date.

          Private Sub Reports_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
          mySql = "Update Studentdata, SET currentDate = Date()"
          ConnDB()
          myCommand = New OleDbCommand(mySql, myConnection)

          End Sub

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          You forgot to execute the SQL command.

          U 2 Replies Last reply
          0
          • U User 11833437

            No luck. I don't get an error it just doesn't do anything to the column.

            Z Offline
            Z Offline
            ZurdoDev
            wrote on last edited by
            #5

            As Richard pointed out, if you have shown all of your code you are never actually executing it.

            Social Media - A platform that makes it easier for the crazies to find each other. Everyone is born right handed. Only the strongest overcome it. Fight for left-handed rights and hand equality.

            1 Reply Last reply
            0
            • L Lost User

              You forgot to execute the SQL command.

              U Offline
              U Offline
              User 11833437
              wrote on last edited by
              #6

              doesn't this execute the command? myCommand = New OleDbCommand(mySql, myConnection)

              D 1 Reply Last reply
              0
              • L Lost User

                You forgot to execute the SQL command.

                U Offline
                U Offline
                User 11833437
                wrote on last edited by
                #7

                That did the trick. I added mycommand.ExecuteNonQuery() and it worked perfect.

                1 Reply Last reply
                0
                • U User 11833437

                  doesn't this execute the command? myCommand = New OleDbCommand(mySql, myConnection)

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

                  No, it just creates a OldDbCommand object. You actually have to tell it to execute using one of the Execute... methods.

                  Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
                  Dave Kreskowiak

                  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