drquochoai Posted July 11, 2015 Share Posted July 11, 2015 My data table is:But when i run this script to insert to my listview:..... _SQLite_Query($dbntdh, "SELECT * FROM data;", $qre) While _SQLite_FetchData($qre, $qrow) = $SQLITE_OK GUICtrlCreateListViewItem(_ArrayToString($qrow, "|"),$gui_ntdh_listtu) WEnd .....He does not show me the texts, he show me the code, i don't know how to convert it to text, please help me:I see the ID in column "STT" is good, but all other column text is not good. Thanks for your advanced helping! Link to comment Share on other sites More sharing options...
jchd Posted July 11, 2015 Share Posted July 11, 2015 It all looks like that data was stored as binary.What is the result of:select distinct typeof(Từ) from data;(please check that I spelled the column name correctly!). Are you getting BLOB somewhere? This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
drquochoai Posted July 12, 2015 Author Share Posted July 12, 2015 Maybe it stored data as binary, because i use this code to store data:$currentTime = _Date_Time_SystemTimeToDateTimeStr(_Date_Time_GetSystemTime(), 1) _SQLite_Exec($dbntdh, "INSERT INTO data (word, mean,time) VALUES ("&_SQLite_Encode($translated[0])&", "&_SQLite_Encode($translated[1])&", "&_SQLite_Encode($currentTime)&");")When i use your code:_SQLite_Query($dbntdh, "SELECT distinct typeof(word) FROM data;", $qre)--->>> He return BLOBSo what should i do know, should i change the store code, or anything else to get BLOB data to display as text. Link to comment Share on other sites More sharing options...
drquochoai Posted July 12, 2015 Author Share Posted July 12, 2015 Thanks for your suggestion, i think he store data as binary, so i use the autoit function BinaryToString to translate it to text as what i want to display:_SQLite_Query($dbntdh, "SELECT * FROM data;", $qre) While _SQLite_FetchData($qre, $qrow) = $SQLITE_OK GUICtrlCreateListViewItem(BinaryToString($qrow[0], 4)&"|"&BinaryToString($qrow[1], 4)&"|"&BinaryToString($qrow[2], 4)&"|"&BinaryToString($qrow[3], 4),$gui_ntdh_listtu) WEndThanks so much, love you so much ! ! Link to comment Share on other sites More sharing options...
jchd Posted July 12, 2015 Share Posted July 12, 2015 (edited) You should have used _SQLite_FastEscape() instead of _SQLite_Encode(). See help to understand the difference.Rather than having leaving the data in a wrong format, I highly recommend changing its type definitely. Make a copy of the DB just in case and apply this:update data set word = cast(word as text);update data set mean = cast(mean as text);update data set time = cast(time as text);Double check that the vietnamese text is OK after that!Note that you can also use SQLite faster internal functions to format the ouput to your needs, simplifying AutoIt code:_SQLite_Query($dbntdh, "SELECT word || '|' || mean || '|' || time FROM data;", $qre) While _SQLite_FetchData($qre, $qrow) = $SQLITE_OK GUICtrlCreateListViewItem($qrow[0], $gui_ntdh_listtu) WEnd Edited July 12, 2015 by jchd This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
drquochoai Posted July 13, 2015 Author Share Posted July 13, 2015 Thanks for your tips, i've tried and that was so excilent, thanks thanks thanks thanks 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