We have created a registration form in Matlab with some field such as name, age, etc. Also we have created a database using Sql Server(ODBC). Now we can read the TextBox values and display it in command window by get property (it is in pushbutton callback). We have to insert that textbox value in database which is already created We use fastinsert comMand. But its just add the values manualLy(using query) into it, but we want to add it through textbox. Our code in push button callback is here.
conn = database('Addface_DSN','sa','123 ');
if(isempty(conn.message))
disp('database connected')
else
disp('cannot connected')
disp(conn.message);
return
end
setdbprefs('DataReturnFormat','numeric')
exdata = {'2','Shalu','22','female'};
fastinsert(conn, 'Faces_Details', {'Id' 'Name' 'Age' 'Gender' },exdata)
commit(conn)
close(conn);
name = get(handles.edit1, 'string'); % we dont want this, But just add to chek. we want this name in database.
disp(name)
age = get(handles.edit2, 'string');
disp(age)