Whats the best to stop existing data being added in an update query?

Tags :    Posted in: Tech Talk

This probably isn’t what you think, but I couldn’t think of an accurate title. I use and INSERT query at the start of my process then an UPDATE query later on. I need to reduce the size of my UPDATE query by stopping it from updating data I already have in my record.

When I say best, I guess I mean quickest to code, least bugs.

I know in dotnet theres datatables and functionality to create SQL statement. But I’m not very familiar with those.

So instead I could :-

A) Use my my existing table class and set the properties in a second instance of the class, just to save the data till later. I could then pass this instance into a comparison function. I think I might have to write this function myself as I’m not aware of any inbuilt dotnet property comparison functionality.

B) I could write something which analyses the actual queries and gain the data from each and make the comparison.

C) I could create an array where I have a structure with two values field name and value, then do the comparison and assignments to it.

Thoughts?

High quality fashion jewellery at a reasonable price!

by JM

Post a comment

You must be logged in to post a comment.