Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Product Manuals » DBISAM Version 4 Manual for C++Builder 6 » Using DBISAM » Searching and Sorting Tables and Query Result Sets |
{ MyTable->IndexName="CustomerName"; // do something }
{ MyTable->IndexFieldNames="CustomerName;CustomerNo"; // do something }
{ // Set to the primary index MyTable->IndexName=""; // Search for customer 100 // With C++, the field values must be passed // as either a TVarRec (for single values) or an // ARRAYOFCONST TVarRec SearchValue=(100); if (MyTable->FindKey(&SearchValue)) { // Record was found, now do something } else { ShowMessage("Record was not found"); } }
{ // Set to the primary index MyTable->IndexName=""; // Search for customer 100 or nearest // With C++, the field values must be passed // as either a TVarRec (for single values) or an // ARRAYOFCONST TVarRec SearchValue=(100); MyTable->FindNearest(&SearchValue); }
{ // Set to the CustomerName secondary index MyTable->IndexName="CustomerName"; // Search for the customer with the // name "The Hardware Store" MyTable->SetKey(); MyTable->FieldByName("CustomerName")->AsString="The Hardware Store"; // This causes the search to only look at the first field // in the current index when searching MyTable->KeyFieldCount=1; if (MyTable->GotoKey()) { // Record was found, now do something } else { ShowMessage("Record was not found"); } }
{ // Set to the CustomerName secondary index MyTable->IndexName="CustomerName"; // Search for the customer with the // name "The Hardware Store" MyTable->SetKey(); MyTable->FieldByName("CustomerName")->AsString="The Hardware Store"; // This causes the search to only look at the first field // in the current index when searching MyTable->KeyFieldCount=1; MyTable->GotoNearest(); }
{ Variant SearchValues[1]; SearchValues[0]=Variant("The Hardware Store"); // Search for the customer with the // name "The Hardware Store" if (MyTable->Locate("CustomerName", VarArrayOf(SearchValues,2), TLocateOptions())) { // Record was found, now do something } else { ShowMessage("Record was not found"); } }
{ Variant SearchValues[1]; SearchValues[0]=Variant("The Hardware Store"); // Search for the customer with the // name "The Hardware Store" if (MyTable->Locate("CustomerName", VarArrayOf(SearchValues,2), TLocateOptions() << loCaseInsensitive)) { // Record was found, now do something } else { ShowMessage("Record was not found"); } }
{ // Search for the first customer with the // name "The Hardware Store" MyTable->Filter="CustomerName="+QuotedStr("The Hardware Store"); // We want the search to be case-insensitive TFilterOptions FilterOptions; FilterOptions->Clear(); FilterOptions << foCaseInsensitive; MyTable->FilterOptions=FilterOptions; if (MyTable->FindFirst()) { // Record was found, now search through // the rest of the matching records while (FindNext()) { // Do something here } } else { ShowMessage("Record was not found"); } }
This web page was last updated on Thursday, November 16, 2023 at 10:39 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |