Delphi is a new visual programming environment, providing us with a convenient and quick windows application development tool. The following are two practical experiences in Delphi programming, which we hope to share with you: 1. Use hypertext link Markup Language (HTML). Access HTML files using open methods (such as IE) in Windows is too large and not flexible. Delphi provides the thtml control, which can call HTML files, but does not detail how to call the HTML files of the Local Machine in its attributes. In fact, this function can be completed as long as the correct URL format is used. The format is as follows: File: hosts & lt; host & gt;/& lt; Path & gt; For example, if the path of an HTML file is C:/help/homehtm, the correct URL format is file: export C:/help/homehtm. Therefore, the HTML file called by the html1 control should be: html1requestdoc (File: Using C:/help/homehtm ). In this way, you can write a program to call HTML files to form an independent help file system. 2. fuzzy query of field data using SQL. As an important symbol of a powerful database application development tool, Delphi supports SQL programming. In the actual process, fuzzy queries are often required for certain fields. For example, if the "name" field is queried, all records of the surname Wang can be automatically listed when "Wang" is entered. In fact, this function can be easily completed by combining the features of SQL and Delphi. The basic principle is: When querying, the query range is controlled between the name greater than 'query string + CHR (0) 'and the smaller than 'query string + CHR ($ ff, you can query all records that meet the conditions. The following is an example: VaR Namestr: string; delimiter: Set the variable in the string. Begin Namestr: = 'wang ′; Query1sqlclear {clear SQL command statements in SQL properties} Query1sqladd ('select * fromcustomdbwhere (name1 & gt; = N1) and (name2 & lt; = n2) '); explain SQL command statement Query1params [0] asstring: = namestr + CHR (0); callback Control Parameter in namestr + CHR (0) Query1params [1] asstring: = namestr + CHR ($ ff); Between bytes and namestr + CHR ($ ff) Query1open; then open the database and execute SQL queries End;(Yang Bo, Shaanxi) |