Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 162745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T11:26:44+00:00 2026-05-11T11:26:44+00:00

I’ve got a simple routine that populates a record in a table. I have

  • 0

I’ve got a simple routine that populates a record in a table. I have fields that I only want to update if an actual change has taken place. The function could get called even if the user did not change anything. Is there an easy way to tell if changes have taken place? Here’s the function:

Sub Edit(ByVal key as Integer, ByVal myval1 As Integer?, ByVal myval2 As Integer?)      Dim db As New MyDatabaseDataContext      Dim form = (From x In db.MyTables Where x.id = key).SingleOrDefault      form.field1 = myval1     form.field2 = myval2      If [???] Then         form.mod_date = Now     End If      db.SubmitChanges()  End Function 

This is a little simplified – I’d rather not check each relationship between field1 and myval1, field2 and myval2, etc., because there could be many fields, and you have to take Nothing into account for each one, blah blah blah. Is there any way to just ask ‘form’ if the assignments actually changed anything? I know behind the scenes it won’t do a database update if nothing has changed, but is that exposed to me before I commit the change?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T11:26:45+00:00Added an answer on May 11, 2026 at 11:26 am

    You can take care of that kind of thing on the DataContext itself.

    For example, you can use the UpdateXXX methods to catch changes to objects and record your date.

    So to relate to your example (assuming you have a class named MyTable), on your DataContext:

    Private Sub UpdateMyTable(ByVal instance As MyTable)     instance.mod_date = Now     Me.ExecuteDynamicUpdate(instance) End Sub 

    As far as I can tell, the DataContext will detect if changes have taken place and only call that method for actual updates (but I could be wrong on this one, I’ll check).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 97k
  • Answers 97k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The guys here at work use this book: Inside the… May 11, 2026 at 7:27 pm
  • Editorial Team
    Editorial Team added an answer A List Apart also, Smashing Magazine is pretty good. as… May 11, 2026 at 7:27 pm
  • Editorial Team
    Editorial Team added an answer I think that you must use .html() instead of .val()… May 11, 2026 at 7:27 pm

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.