Why the result is Ljava.lang.string after i select multiple images & store the to MySql?
1 回表示 (過去 30 日間)
古いコメントを表示
I have chosen several images from a one folder, after i select 3 images & displayed them into edit text.
Edit text displayed like this :
D:/1.jpg
D:/2.jpg
D:/3.jpg
But at the table in gui which displayed that data after i save them to MySql, the data become Ljava.lang.string, not like edit text displayed above. How can i displayed the data like edit text above again?
2 件のコメント
Geoff Hayes
2016 年 5 月 27 日
Alvindra - please show the code that you are using to extract the text from your control and the SQL statement that you have written to save the data to your database. Also, please confirm that the correct filenames (those from above) are being written to the database. If they are, then perhaps it is your SQL statement to get the data from your database that has been incorrectly formed. In either case, you need to show some of the code that you have written.
採用された回答
Geoff Hayes
2016 年 5 月 29 日
Alvindra - unfortunately, I can't run your code (I observe errors as soon as I run launch the GUI). I think the problem is that when you try to save the files to the database, you extract the filenames as
foto = get(handles.txtketfoto, 'String');
foto is most likely a cell array of strings and so you will have to treat it differently. How should this be written to your database? If you have n files, should you insert n records in to the database, one for each file? Or should you convert this cell array of strings to a single string where each filename is separated by a (for example) semi-colon?
5 件のコメント
Geoff Hayes
2016 年 5 月 29 日
Do this after you have gotten the list of photos:
foto = get(handles.txtketfoto, 'String');
if strcmpi(class(foto),'cell')
myFilesAsString = '';
% etc.
else
myFilesAsString = foto;
end
datainsert(conn,'tbl_pca',{'id','nama','alamat','foto'},{id,nama,alamat,myFilesAsString});
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Database Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!