delete selected cell from data base SQL

2 vues (au cours des 30 derniers jours)
Cristian Martin
Cristian Martin le 11 Juin 2022
Commenté : Cristian Martin le 11 Juin 2022
Hi, I have a uitable GUI loaded from an SQL DB and I want to select a row from table and delete also from SQL DB, could you give me a direction ?
D=get(handles.uitable4,'Data');
Index=get(handles.uitable4,'UserData');
D(Index.Indices(:,1), :) = [];
set(handles.uitable4,'Data',D);% here a delete the row only from uitable
conn = database('data_base', '', '');
curs = exec(conn, 'SELECT * FROM prices.prices order by Crt desc');
curs = fetch(curs);
close(curs);
I use R2015a.
Thanks
  1 commentaire
Cristian Martin
Cristian Martin le 11 Juin 2022
function uitable1_CellSelectionCallback(hObject, eventdata, handles)
% hObject handle to uitable1 (see GCBO)
% eventdata structure with the following fields (see MATLAB.UI.CONTROL.TABLE)
% Indices: row and column indices of the cell(s) currently selecteds
% handles structure with handles and user data (see GUIDATA)
handles = guidata(uitable1);
data = get(uitable1, 'Data');
index = Event.Indices;
set(handles.text15, sprintf('%g', data(index(1), index(2))));
I'm trying to get value from cell selected but somewere i'm wrong, where?

Connectez-vous pour commenter.

Réponses (0)

Produits


Version

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by