TAILIEUCHUNG - MASTERING DELPHI 6 phần 6

Trong phần này tôi sẽ chỉ giới thiệu một vài thành phần đơn giản, để cung cấp cho bạn một ý tưởng về các bước cần thiết để xây dựng một và để cho bạn thấy những điều khác nhau mà bạn có thể làm để tùy chỉnh một thành phần hiện có với một số lượng hạn chế của mã. | 536 Chapter 13 Delphi s Database Architecture Both find methods use as parameters an array of constants. Each array element corresponds to one of the fields of the current index. You can also pass only the value for the initial field or fields of the index so the following fields will not be considered. Note I won t discuss these features in details showing complete examples because some of them are limited to the BDE and makes sense only for local tables not for SQL server-based tables. Actually if you set a filter or a range over a Table connected with a SQL server the BDE will try to generate a proper select statement avoiding fetching all the data and filtering it locally. The problem is that this isn t always possible and you lose most of your control two good reasons to use the Query component when working with SQL servers. A Query with Parameters When you need slightly different versions of the same SQL query instead of modifying the text of the Query stored in the SQL property each time you can write a query with a parameter and simply change the value of the parameter. For example if you decide to have a user choose the countries of a continent using the Country table of the DBDEMOS database you can write the following parametric query select from Country where Continent Continent In this SQL clause Continent is a parameter. We can set its data type and startup value using the editor of the Params property collection of the Query component. When the Parameters collection editor is open as shown in Figure you see a list of the parameters defined in the SQL statement and set the data type and the initial value of these parameters. FIGURE Editing the collection of parameters of a Query component The form displayed by this program called ParQuery and available on the companion CD uses a list box to provide all the available values for the parameters. Instead of preparing the items of the list box at design time we can extract the available continents

TỪ KHÓA LIÊN QUAN
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.