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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating View using DBSETPROP

Status
Not open for further replies.

badscots

Programmer
Dec 23, 2003
19
GB
Hello all,

I have a parameterised view on a form with a field that contains encryption, this field is not ticked in the update criteria tab of the view designer the reason for this is that I only want the decrypt routine to change the value in the grid on the form and not the base table, but... I would like the option to turn the update field back on.

I have done this using:

DBSETPROP("V_test_employee","VIEW","SENDUPDATES",.T.)
DBSETPROP("V_test_employee","VIEW","WHERETYPE",3)
DBSETPROP("V_test_employee.surname","FIELD","UPDATABLE",.T.)

Am I missing something here as this does change the field to updateable but if I change the value in the grid it does not update? If I close the form after setting the above and run it again it works!!! Uh...

Suggestions very welcome,

IanMc.
 
IanMc,

I think you also need to set the field's UpdateName property.

(Also, I assume you have the KeyField property set.)

One other point ... Are you sure that the field isn't being updated? Remember, these properties are stored in the DBC. You need to close and re-open the view before they take effect.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Hello Mike,

Im sure the field isnt being updated. The changes to the update property on field X are taking effect, but when I change the value in the field on the grid it should call a trigger and update with the new value.

When the application is loaded the update criteria for field X is not ticked so the value in the base table stays the same - encrypted - and the value in the grid is decrypted. I then set field X to updateable, which does work because Ive displayed this using DBGETPROP. When I edit Field X with a new value it doesnt update the base table or call the update trigger routine. Its as if I need to close the view and reinitialise it?

Any wiser?

IanMc

 
IanMc,

After calling DBSETPROP(), can you see the tick in the view designer? Remeber, DBSETPROP() changes the actual view as it is physically installed in the database. Is that what's happening?

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Hello Mike,

Yes, Ive loaded the application, changed the setting then looked at the view in the project and the field is ticked.

Once I change the field value after changing the Update type, it should call a trigger and update the field ive changed.

Does FPW allow you to change the DB setting whilst the application is running?

IanMc.

 
IanMc,

Does FPW allow you to change the DB setting whilst the application is running?

Yes, you can do it while the app is running, but it doesn't affect any open views. For the change to take effect, you would have to close the view and open it again. I assume you have tried doing that?

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Hello Mike,

I think you may of hit the nail on the head...

I have tried looking for a close view, but only find drop view, delete view etc. Is there actually a way of closing a specific view and opening it after I’ve changed the properties? (most probably me thinks!!!)

Ta,

IanMc.
 
IanMc,

Is there actually a way of closing a specific view and opening it after I’ve changed the properties?

Yes. From the command window:

SELECT ViewName
USE
USE ViewName

Another good way of handling this is to open the Data Session window (from the button on the main toolbar, just to the right of the command window button). That shows all open tables and views. You can use that window to close and re-open a view.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top