Developer’s Guide 1 Contents 3 Tables 27 Figures 29 Introduction 31 What’s in this manual? 31 Manual conventions 33 Developer support services 33 Ordering printed documentation 33 Part I: Programming with Delphi 35 2: Developing applications with Delphi 37 Integrated development environment 37 Designing applications 38 Developing applications 39 Creating projects 39 Editing code 40 Compiling applications 40 Debugging applications 41 Deploying applications 41 3: Using the component libraries 43 Understanding the component libraries 43 Properties, methods, and events 44 Properties 44 Methods 45 Events 45 User events 45 System events 46 Object Pascal and the class libraries 46 Using the object model 46 What is an object? 47 Examining a Delphi object 47 Changing the name of a component 49 Inheriting data and code from an object 50 Scope and qualifiers 50 Private, protected, public, and published declarations 51 Using object variables 52 Creating, instantiating, and destroying objects 53 Components and ownership 53 Objects, components, and controls 54 TObject branch 56 TPersistent branch 56 TComponent branch 57 TControl branch 58 TWinControl/TWidgetControl branch 59 Properties common to TControl 60 Action properties 60 Position, size, and alignment properties 61 Display properties 61 Parent properties 61 A navigation property 61 Drag-and-drop properties 62 Drag-and-dock properties (VCL only) 62 Standard events common to TControl 62 Properties common to TWinControl and TWidgetControl 63 General information properties 63 Border style display properties 64 Navigation properties 64 Drag-and-dock properties (VCL only) 64 Events common to TWinControl and TWidgetControl 64 Creating the application user interface 65 Using Delphi components 65 Setting component properties 66 Using the Object Inspector 66 Using property editors 67 Setting properties at runtime 67 Calling methods 67 Working with events and event handlers 67 Generating a new event handler 68 Generating a handler for a component’s default event 68 Locating event handlers 68 Associating an event with an existing event handler 69 Associating menu events with event handlers 70 Deleting event handlers 70 VCL and CLX components 70 Adding custom components to the Component palette 72 Text controls 73 Text control properties 73 Properties of memo and rich text controls 73 Rich text controls (VCL only) 74 Specialized input controls 74 Scroll bars 74 Track bars 75 Up-down controls (VCL only) 75 Spin edit controls (CLX only) 75 Hot key controls (VCL only) 75 Splitter controls 76 Buttons and similar controls 76 Button controls 76 Bitmap buttons 77 Speed buttons 77 Check boxes 77 Radio buttons 77 Toolbars 78 Cool bars (VCL only) 78 Handling lists 78 List boxes and check-list boxes 79 Combo boxes 79 Tree views 80 List views 80 Date-time pickers and month calendars (VCL only) 81 Grouping components 81 Group boxes and radio groups 81 Panels 81 Scroll boxes 82 Tab controls 82 Page controls 82 Header controls 83 Providing visual feedback 83 Labels and static text components 83 Status bars 84 Progress bars 84 Help and hint properties 84 Grids 85 Draw grids 85 String grids 85 Value list editors (VCL only) 85 Displaying graphics 86 Images 86 Shapes 86 Bevels 87 Paint boxes 87 Animation control (VCL only) 87 Developing dialog boxes 87 Using open dialog boxes 88 Using helper objects 88 Working with lists 89 Working with string lists 89 Loading and saving string lists 90 Creating a new string list 90 Manipulating strings in a list 92 Associating objects with a string list 94 Windows registry and INI files 94 Using TIniFile (VCL only) 94 Using TRegistry 95 Using TRegIniFile 95 Creating drawing spaces 96 Printing 96 Using streams 97 4: Common programming tasks 99 Understanding classes 99 Defining classes 100 Handling exceptions 102 Protecting blocks of code 102 Responding to exceptions 103 Exceptions and the flow of control 104 Nesting exception responses 104 Protecting resource allocations 105 What kind of resources need protection? 105 Creating a resource protection block 106 Handling RTL exceptions 107 What are RTL exceptions? 107 Creating an exception handler 108 Exception handling statements 109 Using the exception instance 109 Scope of exception handlers 110 Providing default exception handlers 110 Handling classes of exceptions 111 Reraising the exception 111 Handling component exceptions 112 Exception handling with external sources 113 Silent exceptions 113 Defining your own exceptions 114 Declaring an exception object type 114 Raising an exception 115 Using interfaces 115 Interfaces as a language feature 116 Implementing interfaces across the hierarchy 116 Using interfaces with procedures 118 Implementing IInterface 118 TInterfacedObject 119 Using the as operator 119 Reusing code and delegation 120 Using implements for delegation 120 Aggregation 121 Memory management of interface objects 122 Using reference counting 122 Not using reference counting 123 Using interfaces in distributed applications (VCL only) 124 Defining custom variants 125 Storing a custom variant type’s data 126 Creating a class to enable the custom variant type 126 Enabling casting 127 Implementing binary operations 128 Implementing comparison operations 130 Implementing unary operations 132 Copying and clearing custom variants 132 Loading and saving custom variant values 133 Using the TCustomVariantType descendant 134 Writing utilities to work with a custom variant type 134 Supporting properties and methods in custom variants 135 Using TInvokeableVariantType 135 Using TPublishableVariantType 137 Working with strings 137 Character types 137 String types 138 Short strings 138 Long strings 139 WideString 139 PChar types 140 OpenString 140 Runtime library string handling routines 140 Wide character routines 141 Commonly used long string routines 141 Declaring and initializing strings 144 Mixing and converting string types 145 String to PChar conversions 145 String dependencies 145 Returning a PChar local variable 146 Passing a local variable as a PChar 146 Compiler directives for strings 147 Strings and characters: related topics 148 Working with files 148 Manipulating files 148 Deleting a file 148 Finding a file 149 Renaming a file 150 File date-time routines 150 Copying a file 151 File types with file I/O 151 Using file streams 152 Creating and opening files 152 Using the file handle 153 Reading and writing to files 153 Reading and writing strings 154 Seeking a file 154 File position and size 155 Copying 155 Converting measurements 156 Performing conversions 156 Performing simple conversions 156 Performing complex conversions 156 Adding new measurement types 157 Creating a simple conversion family and adding units 157 Using a conversion function 158 Using a class to manage conversions 160 Defining data types 162 5: Building applications, components, and libraries 163 Creating applications 163 GUI applications 163 User interface models 164 SDI applications 164 MDI applications 164 Setting IDE, project, and compilation options 165 Programming templates 165 Console applications 165 Service applications 166 Service threads 168 Service name properties 169 Debugging services 170 Creating packages and DLLs 171 When to use packages and DLLs 171 Writing database applications 172 Distributing database applications 173 Creating Web server applications 173 Using Web Broker 173 Creating WebSnap applications 175 Using InternetExpress 175 Creating Web Services applications 175 Writing applications using COM 176 Using COM and DCOM 176 Using MTS and COM+ 176 Using data modules 177 Creating and editing standard data modules 177 Naming a data module and its unit file 178 Placing and naming components 179 Using component properties and events in a data module 179 Creating business rules in a data module 180 Accessing a data module from a form 180 Adding a remote data module to an application server project 181 Using the Object Repository 181 Sharing items within a project 181 Adding items to the Object Repository 181 Sharing objects in a team environment 182 Using an Object Repository item in a project 182 Copying an item 182 Inheriting an item 182 Using an item 183 Using project templates 183 Modifying shared items 183 Specifying a default project, new form, and main form 183 Enabling Help in applications 184 Help system interfaces 184 Implementing ICustomHelpViewer 185 Communicating with the Help Manager 185 Asking the Help Manager for information 186 Displaying keyword-based Help 186 Displaying tables of contents 187 Implementing IExtendedHelpViewer 188 Implementing IHelpSelector 188 Registering Help system objects 189 Registering Help viewers 189 Registering Help selectors 189 Using Help in a VCL Application 190 How TApplication processes VCL Help 190 How VCL controls process Help 190 Using Help in a CLX Application 191 How TApplication processes CLX Help 191 How CLX controls process Help 191 Calling a Help system directly 192 Using IHelpSystem 192 Customizing the IDE Help system 192 6: Developing the application user interface 195 Controlling application behavior 195 Using the main form 195 Adding forms 196 Linking forms 196 Avoiding circular unit references 196 Hiding the main form 197 Working at the application level 197 Handling the screen 197 Managing layout 198 Responding to event notification 199 Using forms 199 Controlling when forms reside in memory 200 Displaying an auto-created form 200 Creating forms dynamically 200 Creating modeless forms such as windows 201 Using a local variable to create a form instance 201 Passing additional arguments to forms 202 Retrieving data from forms 203 Retrieving data from modeless forms 203 Retrieving data from modal forms 204 Reusing components and groups of components 206 Creating and using component templates 207 Working with frames 207 Creating frames 208 Adding frames to the component palette 208 Using and modifying frames 208 Sharing frames 209 Organizing actions for toolbars and menus 210 What is an action? 211 Setting up action bands 212 Creating toolbars and menus 212 Adding color, patterns, or pictures to menus, buttons, and toolbars 214 Adding icons to menus and toolbars 215 Creating toolbars and menus that users can customize 215 Hiding unused items and categories in action bands 216 Using action lists 217 Setting up action lists 217 What happens when an action fires 218 Responding with events 218 How actions find their targets 220 Updating actions 220 Predefined action classes 220 Writing action components 221 Registering actions 222 Creating and managing menus 223 Opening the Menu Designer 223 Building menus 225 Naming menus 226 Naming the menu items 226 Adding, inserting, and deleting menu items 226 Adding separator bars 227 Specifying accelerator keys and keyboard shortcuts 227 Creating submenus 228 Creating submenus by demoting existing menus 229 Moving menu items 229 Adding images to menu items 229 Viewing the menu 230 Editing menu items in the Object Inspector 230 Using the Menu Designer context menu 231 Commands on the context menu 231 Switching between menus at design time 231 Using menu templates 232 Saving a menu as a template 233 Naming conventions for template menu items and event handlers 234 Manipulating menu items at runtime 234 Merging menus 235 Specifying the active menu: Menu property 235 Determining the order of merged menu items: GroupIndex property 235 Importing resource files 236 Designing toolbars and cool bars 236 Adding a toolbar using a panel component 237 Adding a speed button to a panel 238 Assigning a speed button’s glyph 238 Setting the initial condition of a speed button 238 Creating a group of speed buttons 239 Allowing toggle buttons 239 Adding a toolbar using the toolbar component 239 Adding a tool button 240 Assigning images to tool buttons 240 Setting tool button appearance and initial conditions 240 Creating groups of tool buttons 241 Allowing toggled tool buttons 241 Adding a cool bar component 242 Setting the appearance of the cool bar 242 Responding to clicks 243 Assigning a menu to a tool button 243 Adding hidden toolbars 243 Hiding and showing toolbars 243 Demo programs 244 7: Working with controls 245 Implementing drag-and-drop in controls 245 Starting a drag operation 245 Accepting dragged items 246 Dropping items 246 Ending a drag operation 247 Customizing drag and drop with a drag object 247 Changing the drag mouse pointer 248 Implementing drag-and-dock in controls 248 Making a windowed control a docking site 248 Making a control a dockable child 248 Controlling how child controls are docked 249 Controlling how child controls are undocked 250 Controlling how child controls respond to drag-and-dock operations 250 Working with text in controls 250 Setting text alignment 251 Adding scroll bars at runtime 251 Adding the clipboard object 252 Selecting text 252 Selecting all text 253 Cutting, copying, and pasting text 253 Deleting selected text 253 Disabling menu items 254 Providing a pop-up menu 254 Handling the OnPopup event 255 Adding graphics to controls 255 Indicating that a control is owner-drawn 256 Adding graphical objects to a string list 256 Adding images to an application 257 Adding images to a string list 257 Drawing owner-drawn items 257 Sizing owner-draw items 258 Drawing owner-draw items 259 8: Working with graphics and multimedia 261 Overview of graphics programming 261 Refreshing the screen 262 Types of graphic objects 263 Common properties and methods of Canvas 264 Using the properties of the Canvas object 265 Using pens 265 Using brushes 268 Reading and setting pixels 269 Using Canvas methods to draw graphic objects 269 Drawing lines and polylines 270 Drawing shapes 271 Handling multiple drawing objects in your application 272 Keeping track of which drawing tool to use 272 Changing the tool with speed buttons 273 Using drawing tools 273 Drawing on a graphic 276 Making scrollable graphics 276 Adding an image control 277 Loading and saving graphics files 278 Loading a picture from a file 279 Saving a picture to a file 279 Replacing the picture 280 Using the clipboard with graphics 281 Copying graphics to the clipboard 281 Cutting graphics to the clipboard 281 Pasting graphics from the clipboard 282 Rubber banding example 283 Responding to the mouse 283 Responding to a mouse-down action 284 Adding a field to a form object to track mouse actions 286 Refining line drawing 287 Working with multimedia 288 Adding silent video clips to an application 289 Example of adding silent video clips 290 Adding audio and/or video clips to an application 290 Example of adding audio and/or video clips (VCL only) 292 9: Writing multi-threaded applications 295 Defining thread objects 295 Initializing the thread 296 Assigning a default priority 296 Indicating when threads are freed 297 Writing the thread function 298 Using the main VCL/CLX thread 298 Using thread-local variables 299 Checking for termination by other threads 299 Handling exceptions in the thread function 300 Writing clean-up code 300 Coordinating threads 301 Avoiding simultaneous access 301 Locking objects 301 Using critical sections 301 Using the multi-read exclusive-write synchronizer 302 Other techniques for sharing memory 302 Waiting for other threads 303 Waiting for a thread to finish executing 303 Waiting for a task to be completed 303 Executing thread objects 304 Overriding the default priority 305 Starting and stopping threads 305 Debugging multi-threaded applications 306 10: Using CLX for cross-platform development 307 Creating cross-platform applications 307 Porting VCL applications to CLX 308 Porting techniques 309 Platform-specific ports 309 Cross-platform ports 309 Windows emulation ports 309 Porting your application 310 CLX versus VCL 311 What CLX does differently 312 Look and feel 312 Styles 312 Variants 313 Registry 313 Other differences 313 Missing in CLX 314 Features that will not port 314 CLX and VCL unit comparison 315 Differences in CLX object constructors 319 Sharing source files between Windows and Linux 319 Environmental differences between Windows and Linux 320 Directory structure on Linux 322 Writing portable code 323 Using conditional directives 324 Terminating conditional directives 325 Emitting messages 326 Including inline assembler code 326 Messages and system events 327 Programming differences on Linux 328 Cross-platform database applications 329 dbExpress differences 329 Component-level differences 330 User interface-level differences 331 Porting database applications to Linux 331 Updating data in dbExpress applications 333 Cross-platform Internet applications 335 Porting Internet applications to Linux 335 11: Working with packages and components 337 Why use packages? 338 Packages and standard DLLs 338 Runtime packages 338 Using packages in an application 339 Dynamically loading packages 340 Deciding which runtime packages to use 340 Custom packages 340 Design-time packages 341 Installing component packages 341 Creating and editing packages 342 Creating a package 342 Editing an existing package 343 Editing package source files manually 344 Understanding the structure of a package 344 Naming packages 344 Requires clause 344 Contains clause 345 Compiling packages 346 Package-specific compiler directives 346 Using the command-line compiler and linker 348 Package files created by a successful compilation 348 Deploying packages 349 Deploying applications that use packages 349 Distributing packages to other developers 349 Package collection files 349 12: Creating international applications 351 Internationalization and localization 351 Internationalization 351 Localization 352 Internationalizing applications 352 Enabling application code 352 Character sets 352 OEM and ANSI character sets 353 Multibyte character sets 353 Wide characters 354 Including bi-directional functionality in applications 354 BiDiMode property 356 Locale-specific features 358 Designing the user interface 359 Text 359 Graphic images 359 Formats and sort order 360 Keyboard mappings 360 Isolating resources 360 Creating resource DLLs 360 Using resource DLLs 362 Dynamic switching of resource DLLs 363 Localizing applications 363 Localizing resources 363 13: Deploying applications 365 Deploying general applications 365 Using installation programs 366 Identifying application files 366 Application files 367 Package files 367 Merge modules 367 ActiveX controls 369 Helper applications 369 DLL locations 369 Deploying CLX applications 370 Deploying database applications 370 Deploying dbExpress database applications 371 Deploying BDE applications 372 Borland Database Engine 372 SQL Links 372 Deploying multi-tiered database applications (DataSnap) 373 Deploying Web applications 373 Deployment on Apache 374 Programming for varying host environments 375 Screen resolutions and color depths 375 Considerations when not dynamically resizing 375 Considerations when dynamically resizing forms and controls 376 Accommodating varying color depths 377 Fonts 377 Operating systems versions 378 Software license requirements 378 DEPLOY 378 README 379 No-nonsense license agreement 379 Third-party product documentation 379 Part II: Developing database applications 381 14: Designing database applications 383 Using databases 383 Types of databases 384 Database security 385 Transactions 386 Referential integrity, stored procedures, and triggers 387 Database architecture 387 General structure 388 The user interface form 388 The data module 388 Connecting directly to a database server 389 Using a dedicated file on disk 391 Connecting to another dataset 392 Connecting a client dataset to another dataset in the same application 393 Using a multi-tiered architecture 394 Combining approaches 396 Designing the user interface 397 Analyzing data 397 Writing reports 398 15: Using data controls 399 Using common data control features 400 Associating a data control with a dataset 401 Changing the associated dataset at runtime 401 Enabling and disabling the data source 402 Responding to changes mediated by the data source 402 Editing and updating data 403 Enabling editing in controls on user entry 403 Editing data in a control 403 Disabling and enabling data display 404 Refreshing data display 404 Enabling mouse, keyboard, and timer events 405 Choosing how to organize the data 405 Displaying a single record 405 Displaying data as labels 406 Displaying and editing fields in an edit box 406 Displaying and editing text in a memo control 406 Displaying and editing text in a rich edit memo control 407 Displaying and editing graphics fields in an image control 407 Displaying and editing data in list and combo boxes 408 Handling Boolean field values with check boxes 410 Restricting field values with radio controls 411 Displaying multiple records 412 Viewing and editing data with TDBGrid 413 Using a grid control in its default state 413 Creating a customized grid 414 Understanding persistent columns 414 Creating persistent columns 415 Deleting persistent columns 416 Arranging the order of persistent columns 417 Setting column properties at design time 417 Defining a lookup list column 418 Putting a button in a column 419 Restoring default values to a column 419 Displaying ADT and array fields 419 Setting grid options 421 Editing in the grid 423 Controlling grid drawing 423 Responding to user actions at runtime 423 Creating a grid that contains other data-aware controls 424 Navigating and manipulating records 426 Choosing navigator buttons to display 426 Hiding and showing navigator buttons at design time 427 Hiding and showing navigator buttons at runtime 427 Displaying fly-over help 428 Using a single navigator for multiple datasets 428 16: Using decision support components 429 Overview 429 About crosstabs 430 One-dimensional crosstabs 430 Multidimensional crosstabs 431 Guidelines for using decision support components 431 Using datasets with decision support components 432 Creating decision datasets with TQuery or TTable 433 Creating decision datasets with the Decision Query editor 434 Using decision cubes 435 Decision cube properties and events 435 Using the Decision Cube editor 435 Viewing and changing dimension settings 436 Setting the maximum available dimensions and summaries 436 Viewing and changing design options 436 Using decision sources 437 Properties and events 437 Using decision pivots 437 Decision pivot properties 438 Creating and using decision grids 438 Creating decision grids 438 Using decision grids 439 Opening and closing decision grid fields 439 Reorganizing rows and columns in decision grids 439 Drilling down for detail in decision grids 439 Limiting dimension selection in decision grids 440 Decision grid properties 440 Creating and using decision graphs 441 Creating decision graphs 441 Using decision graphs 441 The decision graph display 443 Customizing decision graphs 443 Setting decision graph template defaults 444 Customizing decision graph series 445 Decision support components at runtime 446 Decision pivots at runtime 446 Decision grids at runtime 446 Decision graphs at runtime 447 Decision support components and memory control 447 Setting maximum dimensions, summaries, and cells 447 Setting dimension state 447 Using paged dimensions 448 17: Connecting to databases 449 Using implicit connections 450 Controlling connections 450 Connecting to a database server 451 Disconnecting from a database server 451 Controlling server login 452 Managing transactions 453 Starting a transaction 454 Ending a transaction 455 Ending a successful transaction 456 Ending an unsuccessful transaction 456 Specifying the transaction isolation level 457 Sending commands to the server 458 Working with associated datasets 459 Closing all datasets without disconnecting from the server 460 Iterating through the associated datasets 460 Obtaining metadata 460 Listing available tables 461 Listing the fields in a table 461 Listing available stored procedures 461 Listing available indexes 462 Listing stored procedure parameters 462 18: Understanding datasets 463 Using TDataSet descendants 464 Determining dataset states 465 Opening and closing datasets 466 Navigating datasets 467 Using the First and Last methods 468 Using the Next and Prior methods 468 Using the MoveBy method 469 Using the Eof and Bof properties 469 Eof 469 Bof 470 Marking and returning to records 471 The Bookmark property 471 The GetBookmark method 471 The GotoBookmark and BookmarkValid methods 471 The CompareBookmarks method 471 The FreeBookmark method 471 A bookmarking example 472 Searching datasets 472 Using Locate 472 Using Lookup 473 Displaying and editing a subset of data using filters 474 Enabling and disabling filtering 474 Creating filters 475 Setting the Filter property 475 Writing an OnFilterRecord event handler 476 Switching filter event handlers at runtime 477 Setting filter options 477 Navigating records in a filtered dataset 478 Modifying data 478 Editing records 479 Adding new records 480 Inserting records 481 Appending records 481 Deleting records 481 Posting data 482 Canceling changes 482 Modifying entire records 483 Calculating fields 484 Types of datasets 485 Using table-type datasets 486 Advantages of using table-type datasets 487 Sorting records with indexes 487 Obtaining information about indexes 488 Specifying an index with IndexName 488 Creating an index with IndexFieldNames 489 Using Indexes to search for records 489 Executing a search with Goto methods 490 Executing a search with Find methods 490 Specifying the current record after a successful search 491 Searching on partial keys 491 Repeating or extending a search 491 Limiting records with ranges 492 Understanding the differences between ranges and filters 492 Specifying Ranges 492 Modifying a range 495 Applying or canceling a range 495 Creating master/detail relationships 496 Making the table a detail of another dataset 496 Using nested detail tables 498 Controlling Read/write access to tables 499 Creating and deleting tables 499 Creating tables 499 Deleting tables 502 Emptying tables 502 Synchronizing tables 502 Using query-type datasets 503 Specifying the query 504 Specifying a query using the SQL property 504 Specifying a query using the CommandText property 505 Using parameters in queries 505 Supplying parameters at design time 506 Supplying parameters at runtime 507 Establishing master/detail relationships using parameters 508 Preparing queries 509 Executing queries that don’t return a result set 509 Using unidirectional result sets 510 Using stored procedure-type datasets 510 Working with stored procedure parameters 512 Setting up parameters at design time 512 Using parameters at runtime 514 Preparing stored procedures 514 Executing stored procedures that don’t return a result set 515 Fetching multiple result sets 515 19: Working with field components 517 Dynamic field components 518 Persistent field components 519 Creating persistent fields 520 Arranging persistent fields 521 Defining new persistent fields 521 Defining a data field 522 Defining a calculated field 523 Programming a calculated field 523 Defining a lookup field 524 Defining an aggregate field 526 Deleting persistent field components 526 Setting persistent field properties and events 526 Setting display and edit properties at design time 527 Setting field component properties at runtime 528 Creating attribute sets for field components 528 Associating attribute sets with field components 529 Removing attribute associations 530 Controlling and masking user input 530 Using default formatting for numeric, date, and time fields 530 Handling events 531 Working with field component methods at runtime 532 Displaying, converting, and accessing field values 533 Displaying field component values in standard controls 533 Converting field values 533 Accessing field values with the default dataset property 535 Accessing field values with a dataset’s Fields property 535 Accessing field values with a dataset’s FieldByName method 536 Setting a default value for a field 536 Working with constraints 537 Creating a custom constraint 537 Using server constraints 537 Using object fields 538 Displaying ADT and array fields 539 Working with ADT fields 539 Using persistent field components 540 Using the dataset’s FieldByName method 540 Using the dateset’s FieldValues property 540 Using the ADT field’s FieldValues property 540 Using the ADT field’s Fields property 541 Working with array fields 541 Using persistent fields 541 Using the array field’s FieldValues property 541 Using the array field’s Fields property 542 Working with dataset fields 542 Displaying dataset fields 542 Accessing data in a nested dataset 542 Working with reference fields 543 Displaying reference fields 543 Accessing data in a reference field 543 20: Using the Borland Database Engine 545 BDE-based architecture 545 Using BDE-enabled datasets 546 Associating a dataset with database and session connections 547 Caching BLOBs 548 Obtaining a BDE handle 548 Using TTable 548 Specifying the table type for local tables 549 Controlling read/write access to local tables 550 Specifying a dBASE index file 550 Renaming local tables 551 Importing data from another table 552 Using TQuery 552 Creating heterogeneous queries 553 Obtaining an editable result set 554 Updating read-only result sets 555 Using TStoredProc 555 Binding parameters 556 Working with Oracle overloaded stored procedures 556 Connecting to databases with TDatabase 556 Associating a database component with a session 557 Understanding database and session component interactions 557 Identifying the database 557 Opening a connection using TDatabase 559 Using database components in data modules 560 Managing database sessions 560 Activating a session 561 Specifying default database connection behavior 562 Managing database connections 563 Working with password-protected Paradox and dBASE tables 565 Specifying Paradox directory locations