How can i display the data what i want to looking into the table?

1 次查看(过去 30 天)
i Have a GUI like this :
I have about 100 data stored in MySQL databse and everything telahh I show into a table that was in the GUI. To search for a specific name of the many data, then I make an edit text and search button. Edit text input is useful to accommodate the form of the name you want to search and find useful buttons to execute her. My question is how I can display only the data I was looking just in the table? before I have made a code in the search button, but when I was looking for, which is still performed all of the existing data in the database and not the data that is specific to that I typed in the edit text. The following is the code:
%if true
cari=char(get(handles.txtcari,'string'));
conn=database('pca','root','','com.mysql.jdbc.Driver','jdbc:mysql://localhost:3306/');
sqlquery = ['select * from tbl_pca where id =''' cari ''''];
curs = exec(conn,sqlquery);
fetch(curs);
exec(conn, 'rollback');
exec(conn, 'commit');
[ mydata,header,no ] = Lihat()
set(handles.myTabel,'data',mydata,'ColumnName',header,'RowName',no);
set(handles.myTabel,'Data',mydata);% code
%end
  1 个评论
Geoff Hayes
Geoff Hayes 2016-5-29
Alvindra - does your above code (with the where clause) actually return the subset of data? And is it this subset of data that you want to display in the GUI (and so replace the previous set)?

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Database Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by