Queener Posted May 6, 2014 Share Posted May 6, 2014 (edited) I created 2 input boxes and 1 button. $searchinput = textbox that will be used to search $nameinput = textbox that will be displaying the result. (I'm not using a label because I'm going to impliment it later on to modify data and save records) $searchb1 = the button to press when search is ready. Goal: type an employee name on the searchinput and press the search button. If employee name exist, show it on the nameinput textbox. Func SearchUser() $query_name = "SELECT * from employers where Full_Name = '%" & $searchinput & "%'" $exe_name = _Query($SQLOBJ, $query_name) with $exe_name while NOT .EOF GUICtrlSetData($nameinput, .Fields('Full_Name').value) .MoveNext WEnd EndWith EndFunc I tested with the msgbox and it works fine. Can someone show me the official way on how to get this to work with the textbox? I'm using the sql.au3. thanks, Edited May 6, 2014 by asianqueen Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.") Link to comment Share on other sites More sharing options...
mikell Posted May 6, 2014 Share Posted May 6, 2014 This SQL.au3 is obsolete since AutoIt3 has now the SQLite.au3 file provided in the install Link to comment Share on other sites More sharing options...
argumentum Posted May 6, 2014 Share Posted May 6, 2014 I created 2 input boxes and 1 button. $searchinput = textbox that will be used to search $nameinput = textbox that will be displaying the result. (I'm not using a label because I'm going to impliment it later on to modify data and save records) $searchb1 = the button to press when search is ready. Goal: type an employee name on the searchinput and press the search button. If employee name exist, show it on the nameinput textbox. Func SearchUser() $query_name = "SELECT * from employers where Full_Name = '%" & $searchinput & "%'" $exe_name = _Query($SQLOBJ, $query_name) with $exe_name while NOT .EOF GUICtrlSetData($nameinput, .Fields('Full_Name').value) .MoveNext WEnd EndWith EndFunc I tested with the msgbox and it works fine. Can someone show me the official way on how to get this to work with the textbox? I'm using the sql.au3. thanks, maybe if .Fields('Full_Name').value <> "" then GUICtrlSetData($nameinput, .Fields('Full_Name').value) Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Queener Posted May 6, 2014 Author Share Posted May 6, 2014 (edited) maybe if .Fields('Full_Name').value <> "" then GUICtrlSetData($nameinput, .Fields('Full_Name').value) I'm seeing result, but wrong result. Say I search 'John', it came out Kathy. Any search comes out the same result Kathy. Nevermind, I got it... $query_name = "SELECT * from employers WHERE Full_Name like '%" & GUICtrlRead($searchinput) & "%'" $exe_name = _Query($SQLOBJ, $query_name) Forgot to add GUICtrlRead Edited May 6, 2014 by asianqueen Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.") Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now