Welcome! Log In Create A New Profile

Advanced

[WD] SQL Query one EDT control for four SQL parameters?

Posted by infos 
[WD] SQL Query one EDT control for four SQL parameters?
June 07, 2022 10:27AM
Hello everyone

I need to do a search in one of my applications based on SQL queries. I placed the fillers on four columns in the parameter table. The client's requirement is that it can search all four queries from one Edit control. Search first the first parameter if it does not exist search the second parameter, if it does not exist search the third parameter and then the fourth. How do I set up a query and search loop? Has anyone had a similar task?

[infosonline.net]
if the same value is not in all four column, then a simple OR query will do

select x from xxx where col1=value or col2=value or col3=value or col4=value

If the same value CAN be found in different column and your description implies an EXCLUSIVE search (ie if found on first column, do NOT look also for it in second column), then a succession of four simple queries with a test if something is found between each will do the work
Re: [WD] SQL Query one EDT control for four SQL parameters?
June 07, 2022 11:44PM
Hello Argus

I solved the problem as follows


QRY_QUERY.Param1 = EDT_XXX
IF HExecuteQuery(QRY_QUERY,hQueryDefault) THEN
	QRY_QUERY.Param2 = EDT_XXX
	IF HExecuteQuery(QRY_QUERY,hQueryDefault) THEN
		QRY_QUERY.Param3 = EDT_XXX
		IF HExecuteQuery(QRY_QUERY,hQueryDefault) THEN
                        Process....
			HFreeQuery(QRY_QUERY) 
		END
		Process....
                HFreeQuery(QRY_QUERY) 
	END
        Process......
	HFreeQuery(QRY_QUERY) 
END

[infosonline.net]



Edited 1 time(s). Last edit at 06/07/2022 11:45PM by infos.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: