Terminal in VB.dbf and index files

zhaozj2021-02-11  209

Terminal in VB.dbf and index files

http://www.tongyi.net Author: Li Yang Rong Hits: 431

How to use the programming language other than Fox to get the record value of the.dbf database and references. IDX and .cdx index have always been one of the topics discussed by programmers. One task is to join a user query water fees in a touch screen system. Each user can query your own water recording at any time. I use VB5.0, I hope to open seven .dbf data sheets of the business toll system under the NetWare system and query. Each data sheet has nearly 100,000 records. Switching data through 10M hubs, querying fields are not unique. Obviously this large amount of data is passed through 10M network. If VB uses SQL mode queries, at least 2 minutes can get a reply. It is unrealistic to let a user wait 2 minutes next to the machine. So I want to use FoxPro itself .idx or .cdx index file to find. Programming can be implemented in two ways. One is to call directly in VB, another use of the SHELL function in VB to call the EXE program of FoxPro. Method 1, call the .dbf file directly in VB directly. Create a .inf text file step as the FoxPro database file name in the directory of the FoxPro database: 1. Create a text file * .inf, with the same name as the data sheet. 2. In the first line of text file, enter [FoxPro 2.5]; if specified is the FoxPro 2.0 index, enter [FoxPro 2.0], and the rest is pushed. 3. Enter the specified index file name form IDXN = *. IDX or CDXN = *. CDX. Where n is a number, it represents the first IDX index file, and the second IDX index file. Or the first CDX index file, the second ... is pushed. Note: If the .inf file is not stored in the same directory in the same directory, or for maintenance, you want to store all files in a shared point. You can use the method of creating a Windows registry key, pointing to the file path of the storage .inf. (For details, please refer to the VB5 online manual) Second, the writing program opens the external FoxPro table directly with the OpenDatabase method. The main statement is as follows: DIM DB AS DATABASE DIM TB As Recordset 'Opens the external database SET DB = OpenDatabase ("c: / fox /", false, false, "foxpro 2.5;")' Note that FoxPro and 2.5 must have space Set TB = DB.OpenRecordset ("ABC") 'call index TB.Index = "abc1 # idx"' Note index name "index file name # suffix name" tb.seek "=", "111-111" search unique A number of records for "111-111", use the shell () function to call the VF ID file to accept the user command, then call the VF .prg compiled .exe file, press the user to query in the database, will query The result is placed in a .txt file. VB Number Display from the .txt file, then pass the query result to the VF .prg compiled .exe file, query extract. Specifically programming, here you should focus on the characteristics of the shell () function: The shell function is in an asynchronous manner to perform other programs. That is, the program that is started with shell may have not completed the execution process, and the statement after the shell function has been executed. This execution method disrupted the inherent order of execution, if not paying attention, the run of the program will generate confusion. If the statement is as follows ... shell (c: /file1.exe) 'calls the file.exe file, and place the result in the x1.txt for output as # 1' opens the x1.txt file, take search result. ...... According to the general execution, the above statement should be implemented correctly.

转载请注明原文地址:https://www.9cbs.com/read-5441.html

New Post(0)