Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

formview updates all the values not just those that changed ?

Status
Not open for further replies.

tango1948

Programmer
Dec 23, 2006
111
IL
I have a Formview with a large number of fields, the update statement updates all the fields in the form.
Is it possible to dynamicaly generate code that only updates fields whos values have changed?

Thanks for any help

David
 
It's a lot easier to update everything then to pick and choose. You'd have to loop through every control and compare it to it's old value. Which means you'd have to make a way to look at the old value to do the comparison. Then you'd dynamically create a SQL update statement from all that afterwards, if you went through all the trouble of doing that.

 
Hi,
I was thinking about using the TextBox onChange event to build up the Update statement, seems logical and simple or am I missing something?
 
There is no reason to check what has changed. As tperry pointed out, it is a lot of unnecessary coding. An update statment that includes 1000 columns or 1 column will have the same inpact on the database.
 
Thanks for the reply, at the moment I have a form with over 100 fields from an AccessDataSource which I display in several collapsible <divs>. When Irun the update command
I recieve a "Query is too complex" error (Access has some limitatiions in the size of a query) which is why I wanted to create a shorter update command, but I understand it's best to create several smaller forms.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top