How to delete a record from mysql database from matlab?

조회 수: 1 (최근 30일)
Prashant
Prashant 2014년 4월 20일
답변: JohnGalt 2016년 5월 20일
This is my code which i'm using to delete a record of mysql databse from matlab, but it's giving an error........... plz let me know the correct code.........
-------------------------------------------------------------------------------------------
% --- Executes on button press in pushbutton1. function pushbutton1_Callback(hObject, eventdata, handles) % hObject handle to pushbutton1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) conn=database('INVENTORY','root',''); p=get(handles.edit1,'string'); q=get(handles.edit2,'string');
columnnames = {'itemid','itemname'};
data = {p,q}; delete(conn,'additem',columnnames,data); exec(conn, 'DELETE FROM `additem` WHERE `itemid` = ''p''' ); curs = fetch(curs); curs.Data h=msgbox('DATA DELETED'); pause(2);
close(conn);
close(Additem);
Deleteitem

답변 (1개)

JohnGalt
JohnGalt 2016년 5월 20일
Use this (doesn't require the database toolbox): http://www.mathworks.com/matlabcentral/fileexchange/57195-niallhurley-mysql-matlab Then delete the record just using the appropriate SQL query - no need for other functions.

카테고리

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