Podobne
- Strona startowa
- Bruce Morris Adventure Guide Florida Keys & Everglades National Park (2005)
- The Career Survival Guide Dealing with Office Politics Brian OConnell
- True Magick A Beginner's Guide by Amber K (2003)
- Corel PHOTO PAINT 11 User Guide
- (Ross Enamait) The Underground Guide To Warrior Fitness
- Novell Netware 5 Advanced Admin Instructor guide
- linuxadm (6)
- Michal Tombak Uleczyc nieuleczalne czesc 1
- Księga tysiąca i jednej nocy
- Chmielewska Joanna Studnie Przodkow 1
- zanotowane.pl
- doc.pisz.pl
- pdf.pisz.pl
- btobpoland.keep.pl
Cytat
Do celu tam się wysiada. Lec Stanisław Jerzy (pierw. de Tusch-Letz, 1909-1966)
A bogowie grają w kości i nie pytają wcale czy chcesz przyłączyć się do gry (. . . ) Bogowie kpią sobie z twojego poukładanego życia (. . . ) nie przejmują się zbytnio ani naszymi planami na przyszłość ani oczekiwaniami. Gdzieś we wszechświecie rzucają kości i przypadkiem wypada twoja kolej. I odtąd zwyciężyć lub przegrać - to tylko kwestia szczęścia. Borys Pasternak
Idąc po kurzych jajach nie podskakuj. Przysłowie szkockie
I Herkules nie poradzi przeciwko wielu.
Dialog półinteligentów równa się monologowi ćwierćinteligenta. Stanisław Jerzy Lec (pierw. de Tusch - Letz, 1909-1966)
[ Pobierz całość w formacie PDF ]
.The string contains the filter s test condition.Forexample, the following statement creates a filter that tests a dataset s State field to seeif it contains a value for the state of California:Dataset1->Filter = State = CA ;You can also supply a value for Filter based on the text entered in a control.Forexample, the following statement assigns the text in an edit box to Filter:Dataset1->Filter = Edit1->Text;You can, of course, create a string based on both hard-coded text and data entered bya user in a control:Dataset1->Filter = AnsiString( State = ) + Edit1->Text + ;After you specify a value for Filter, to apply the filter to the dataset, set the Filteredproperty to true.You can also compare field values to literals, and to constants using the followingcomparison and logical operators:Table 19.4 Comparison and logical operators that can appear in a filterOperator MeaningGreater than>= Greater than or equal to1400) AND (Custno FieldByName[ State ]->AsString == CA ;}When filtering is enabled, an OnFilterRecord event is generated for each recordretrieved.The event handler tests each record, and only those that meet the filter sconditions are displayed.Because the OnFilterRecord event is generated for everyrecord in a dataset, you should keep the event handler as tightly-coded as possible toavoid adversely affecting the performance of your application.Switching filter event handlers at runtimeYou can code any number of filter event handlers and switch among them atruntime.To switch to a different filter event handler at runtime, assign the new eventhandler to the dataset s OnFilterRecord property.For example, the following statements switch to an OnFilterRecord event handlercalled NewYorkFilter:DataSet1->OnFilterRecord = NewYorkFilter;Refresh;Setting filter optionsThe FilterOptions property enables you to specify whether or not a filter thatcompares string-based fields accepts records based on partial comparisons andwhether or not string comparisons are case-sensitive.FilterOptions is a set propertyUnder st andi ng dat aset s 19-19Di s p l a y i n g a n d e d i t i n g a s u b s e t o f d a t a u s i n g f i l t e r sthat can be an empty set (the default), or that can contain either or both of thefollowing values:Table 19.5 FilterOptions valuesValue MeaningfoCaseInsensitive Ignore case when comparing strings.foNoPartialCompare Disable partial string matching (i.e., do not match strings ending with anasterisk (*)).For example, the following statements set up a filter that ignores case whencomparing values in the State field:TFilterOptions FilterOptions;FilterOptions->Clear();FilterOptions Filter = State = 'CA' ;Navigating records in a filtered datasetThere are four dataset methods that enable you to navigate among records in afiltered dataset.The following table lists these methods and describes what they do:Table 19.6 Filtered dataset navigational methodsMethod PurposeFindFirst Move to the first record in the dataset that matches the current filter criteria.Thesearch for the first matching record always begins at the first record in theunfiltered dataset.FindLast Move to the last record in the dataset that matches the current filter criteria.FindNext Moves from the current record in the filtered dataset to the next one.FindPrior Move from the current record in the filtered dataset to the previous one.For example, the following statement finds the first filtered record in a dataset:DataSet1->FindFirst();Provided that you set the Filter property or create an OnFilterRecord event handler foryour application, these methods position the cursor on the specified record whetheror not filtering is currently enabled for the dataset.If you call these methods whenfiltering is not enabled, then they" Temporarily enable filtering." Position the cursor on a matching record if one is found." Disable filtering.Note If filtering is disabled and you do not set the Filter property or create anOnFilterRecord event handler, these methods do the same thing as First(), Last(),Next(), and Prior().19-20 Dev el oper s Gui deMo d i f y i n g d a t aAll navigational filter methods position the cursor on a matching record (if one iffound) make that record the current one, and return true.If a matching record is notfound, the cursor position is unchanged, and these methods return false.You cancheck the status of the Found property to wrap these calls, and only take action whenFound is true.For example, if the cursor is already on the last matching record in thedataset, and you call FindNext, the method returns false, and the current record isunchanged.Modifying dataYou can use the following dataset methods to insert, update, and delete data:Table 19.7 Dataset methods for inserting, updating, and deleting dataMethod DescriptionEdit Puts the dataset into dsEdit state if it is not already in dsEdit or dsInsert states.Append Posts any pending data, moves current record to the end of the dataset, and puts thedataset in dsInsert state.Insert Posts any pending data, and puts the dataset in dsInsert state.Post Attempts to post the new or altered record to the database.If successful, the datasetis put in dsBrowse state; if unsuccessful, the dataset remains in its current state.Cancel Cancels the current operation and puts the dataset in dsBrowse state.Delete Deletes the current record and puts the dataset in dsBrowse state.Editing recordsA dataset must be in dsEdit mode before an application can modify records.In yourcode you can use the Edit method to put a dataset into dsEdit mode if the read-onlyCanModify property for the dataset is true.CanModify is true if the table(s) underlyinga dataset permits read and write privileges.On forms in your application, some data-aware controls can automatically put adataset into dsEdit state if" The control s ReadOnly property is false (the default)," The AutoEdit property of the data source for the control is true, and" CanModify is true for the dataset.Important For TTable components with the ReadOnly property set to true and TQuerycomponents with the RequestLive property set to false, CanModify is false, preventingediting of records.Note Even if a dataset is in dsEdit state, editing records may not succeed for SQL-baseddatabases if your application s user does not have proper SQL access privileges.Once a dataset is in dsEdit mode, a user can modify the field values for the currentrecord that appears in any data-aware controls on a form.Data-aware controls forwhich editing is enabled automatically call Post when a user executes any action thatchanges the current record (such as moving to a different record in a grid).Under st andi ng dat aset s 19-21Mo d i f y i n g d a t aIf you provide a navigator component on your forms, users can cancel edits byclicking the navigator s Cancel button.Canceling edits returns a dataset to dsBrowsestate.In code, you must write or cancel edits by calling the appropriate methods.You writechanges by calling Post.You cancel them by calling Cancel.In code, Edit and Post areoften used together
[ Pobierz całość w formacie PDF ]