• Post Reply Bookmark Topic Watch Topic
  • New Topic

B&S question about new values in updateRecord

 
Steve Taiwan
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume, in updateRecord(long recNo, String[] data, long lockCookie),
String [] data contains only new values and no old values.
am I correct?

ex: If I want to update name of recNo 1, then in String[] data,
the data structure should be like data[0]="new name", data[1]="", data[2]="", data[3]=""
........am I right??

 
Jared Chapman
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Steve,

Good question.

I do not think you should use "" as an indication that a field should not be updated. What would happen if you wanted to intentionally delete a field?

This is how I have handled it so far:

This allows me to update a record in one of two ways:
1. String[] newData = {"new name", "old location", ..., "old owner"};
OR
2. String[] newData = {"new name", null, null, null, null, null};

And as always, it will be well documented.
 
Steve Taiwan
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the reply.
Greate solution.
I redesigned and changed my code according to your suggestion.
Thanks again.
 
I child proofed my house but they still get in. Distract them with this tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!