Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Manipulating data with objects
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00395398
Message ID:
00395450
Vues:
11
This time without the font typo.

>>I have a feeling I'm about to learn something.
>>
>>I have a form with a view in the D.E.
>>
>>This is the code on load:
>>
>>SET PATH TO ('C:\DiamondAcct\Data\')
>>OPEN DATABASE Tomparco SHARED
>
>Do not need the above 2 lines. The database should already be open. Open it in your main PRG and SET DATABASE TO TOMPARCO right after youopen the DBC. You should also set your VFP search paths at the beginning of your main PRG.
>
>>SET EXCLUSIVE OFF
>
>Good. Also should add SET TALK OFF.
>
>>DBSETPROP('intrancust', 'view', 'Tables', 'Tomparco!inventory')
>>DBSETPROP('intrancust', 'view', 'SendUpdates',.F.)
>
>The 2 lines above only need to be set one time -- at design time. You should never have to do this in actual code that goes to the users. The exception is if you really do need to change these properties on the fly. So I would leave the SendUpdates property set to TRUE.
>
>>=CURSORSETPROP("Buffering", 3, "intrancust")
>
>I prefer table buffering [5], but that is a personal preference that is mostly shared by other developers. The reason is an implicit Tableupdate() is issued every time the record pointer moves. Even if it is just 1 record in my view, I use table buffering. This gives me TOTAL control on when a Tableupdate is issued. In my form Save method, I programmatically perform table updates if the user did not click the CANCEL command button. The CANCEL set a form parameter, lCanceled, to TRUE if clicked.
>
>>INDEX ON stocknum TAG stocknum
>
>Indexing the view. OK.
>
>>On the form is a combobox we'll call C1 and a textbox we'll call T1. C1's rowsource is a field of the view called stocknum. T1's visible property is set to .F. and its ControlSource is the same field stocknum.
>>
>>Another item on the form is an append button. When pressed, C1's visible property goes to .F., and T1's goes to .T. so that new data can be entered. This is the procedure in the click event:
>>
>>Thisform.C1.Visible = .F.
>>Thisform.T1.Visible = .T.
>>clear
>>ThisForm.Text1.value = ""
>>DBSETPROP('intrancust', 'view', 'Tables', 'Tomparco!inventory')
>>DBSETPROP('intrancust', 'view', 'SendUpdates',.T.)
>
>DBSetProp commands not needed. See above comments
>
>>APPEND BLANK
>>
>>I now enter data into T1 and press the save button, which runs this:
>>
>> REPLACE stocknum WITH Thisform.T1.value
>>=TableUpdate(.T.)
>>
>>If I now close the form and browse my the table it wrote to (through the view), the new row of data was added beautifully, but whatever data that was showing in C1 before the append has been erased (For example if the data in C1 was "BR-549", then "BR-549" is now a blank field of whatever record it was the stocknum for).
>>
>>I'm not really clear on what's happening nor what to do about it. If someone would enlighten me, I would be greatly endebted.
>
>Is the C1 field updatable? Why do you have 2 controls bound to the same field? This is the cause of the problem. If you want to be able to use either control, do not bind either control to the stocknum field. When you save, use the value from only 1 of the controls to REPLACE the value of the stocknum field [you will have to use a replace statement].
Mark McCasland
Midlothian, TX USA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform