khang0001 0 Posted February 28, 2011 (edited) I have the database name a b c d e khang 1 2 3 4 5 tuan 6 7 8 9 10 minh 11 12 13 14 15 toan 16 17 18 19 20 tan 21 22 23 24 25 I want to search the column and the row ex : if khang and e the result is 5 if tan and c the result is 23 if minh and d the result is 14 please help me how can i search the string in database my database is sqlite Edited February 28, 2011 by khang0001 Share this post Link to post Share on other sites
SmOke_N 211 Posted February 28, 2011 Would help to know what kind of database it is. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Share this post Link to post Share on other sites
khang0001 0 Posted February 28, 2011 my database is sqlite in autoit Share this post Link to post Share on other sites
saywell 3 Posted February 28, 2011 (edited) The sql is:SELECT e FROM [tablename] WHERE name= 'khang';Look in the helpfiles [uDFs - SQLite Management] for how to run that in autoit.William Edited February 28, 2011 by saywell Share this post Link to post Share on other sites
wolf9228 65 Posted February 28, 2011 (edited) I have the database name a b c d e khang 1 2 3 4 5 tuan 6 7 8 9 10 minh 11 12 13 14 15 toan 16 17 18 19 20 tan 21 22 23 24 25 I want to search the column and the row ex : if khang and e the result is 5 if tan and c the result is 23 if minh and d the result is 14 please help me how can i search the string in database my database is sqlite #Include <Date.au3> #include <SQLite.au3> #include <SQLite.dll.au3> FileDelete("Database.db") Dim $hQuery , $aRow _SQLite_Startup () $DatabaseH = _SQLite_Open("Database.db") _SQLite_Exec (-1, "CREATE TABLE iTABLE (name,a,b,c,d,e);") _SQLite_Exec (-1, "INSERT INTO iTABLE (name,a,b,c,d,e) VALUES ('khang','1','2','3','4','5');") _SQLite_Exec (-1, "INSERT INTO iTABLE (name,a,b,c,d,e) VALUES ('tuan','6','7','8','9','10');") _SQLite_Exec (-1, "INSERT INTO iTABLE (name,a,b,c,d,e) VALUES ('minh','11','12','13','14','15');") _SQLite_Exec (-1, "INSERT INTO iTABLE (name,a,b,c,d,e) VALUES ('toan','16','17','18','19','20');") _SQLite_Exec (-1, "INSERT INTO iTABLE (name,a,b,c,d,e) VALUES ('tan','21','22','23','24','25');") $BOOL = TableSearch($DatabaseH,"iTABLE","name,e","'khang','5'") MsgBox(0,"",$BOOL) $BOOL = TableSearch($DatabaseH,"iTABLE","name,a,b,c,d,e","'tuan','6','7','8','9','10'") MsgBox(0,"",$BOOL) $BOOL = TableSearch($DatabaseH,"iTABLE","name,e","'khang','100'") MsgBox(0,"",$BOOL) $BOOL = TableSearch($DatabaseH,"iTABLE","name,a,b,c,d,e","'tuan','6','7','8','9','200'") MsgBox(0,"",$BOOL) Func TableSearch($DatabaseH,$iTABLE,$ColumnsList,$ValuesList) $SplitColumns = StringSplit($ColumnsList,",") $SplitValues = StringSplit($ValuesList,",") if $SplitColumns[0] <> $SplitValues[0] Then Return SetError(1,0,False) For $i = 1 To $SplitColumns[0] _SQlite_Query($DatabaseH, "SELECT " & $SplitColumns[$i] & " FROM " & $iTABLE & " WHERE " & $SplitColumns[$i] & " = " & $SplitValues[$i] & ";", $hQuery) if _SQLite_FetchData ($hQuery, $aRow) <> $SQLITE_OK Then Return SetError(2,0,False) Next Return SetError(0,0,True) EndFunc Edited February 28, 2011 by wolf9228 صرح السماء كان هنا Share this post Link to post Share on other sites