Inquiry like Windows

zhaozj2021-02-16  44

Win2k Delphi5 SQL Server2k is compiled, and it is executed. Const smain_sql = 'select ... from ... where (...)' // uses alias, so there is "A.fitemno" such as SEMPTY = ''; Sitem_Type = 'FiteMTYPE';

procedure SelectStock; var stItemNo, stItemName, SQL: string; begin adsStock.Active: = False; SQL: = sMAIN_SQL; adsStock.CommandText: = SQL; if Trim (edtItemNo.Text) <> sEMPTY then begin stItemNo: = StringReplace (Trim (EDTITEMNO.TEXT), '*', '%', [RFREPLACEALL]); SQL: = SQL 'AND A.FITEMNO LIKE' '' STITEMNO '' ''; AdsSstock.commandText: = SQL; END; If Trim (edtitemname.text) <> SEMPTY THEN BEGIN STITEMNAME: = STRINGREPLACE (TRIM (EDTITEMNAME.TEXT), '*', '%', [RFREPLACEALL]); SQL: = SQL 'and A.fiteMname Like' ' ' stItemName ' '' '; adsStock.CommandText: = SQL; end; if cbbItemType.Text <> sEMPTY then begin SQL: = SQL ' AND B.fItemType =: fItemType '; adsStock.CommandText: = SQL; adsStock .Parameters.Parambyname (Sitem_Type) .Value: = cbbitype.text; end; ... // Other conditions Adsstock.active: = true; end; This, if the user does not enter any restrictions, press SMAIN_SQL query The results. Once the user enters a condition similar to "1- * 05 *", it will perform a blurry query similar to the Windows query.

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

New Post(0)