Avatar of Jimbo99999
Flag for United States of America asked on

VB.Net - DataGridView update LastUpdated field in SQL Table

Good Day Experts!

I am shopping for assitance with a new task in my project that I do not understand hot to achieve it in VB.net.  I have a DataGridView that presents the User with SQL table data.  The User updates the data ans hits the <Update> button and the updates are written back to the SQL table.

My new task is in that SQL table I need to update the [LAST UPDATED] field when a change is made to a record.  

So far I have gone down this path:
    1)Put [LAST UPDATED] in my DataGridView so it can be in the dataTable that gets pulled
       down from db so I can send changes to it back to the database
    2)So, now have to figure out how to get the current date/time stamp into the
       DataGridView Last Update column when changes to the record in the DataGridView
       is made?
    3)When I run the UpdateCommand then it gets updated back to the database?

Am I on the right track? If, so what do I do next?

Visual Basic.NET

Avatar of undefined
Last Comment

8/22/2022 - Mon
Nasir Razzaq

Do you use adapter to update? Does user only change one row? Or multiple rows? You can use a trigger on the table though its not the preferred approach.


Yes I am using the adapter and they can change multiple row in the grid at a time.

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.

Excellent...I was able to get it working with your suggestion.  Thanks for the helpful link as well.

I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck