How to compare values in login page with values from database in App Designer?

I want to get the editfield values and compare it with the value in database for login purpose. Can anyone help me?
This is my code to compare the values.
a=app.UsernameEditField.Value;
b=app.PasswordEditField.Value;
conn = database('Wicapp','root','');
v = exec(conn,'select Username from wicapp.users');
w = exec(conn,'select Password from wicapp.users');
v=fetch(v);
w=fetch(w);
v1=v.Data;
w1=w.Data;
if strcmpi(a, v1)&&strcmpi(b,w1)
run('receive_try_interface.mlapp')
end

回答 (1 件)

Prabhanjan Mentla
Prabhanjan Mentla 2021 年 1 月 9 日

0 投票

Hi,
You can follow this steps.
  • You can open connection
  • Check whether user exists in the database with the help of this type of sql query.
  • If user exists then, fetch the password and compare it with the given password.
  • If both passwords match then “Login Success” else login fail.
To connect from Appdesigner to a database toolbox you can check this link. I recommend you to go through the Database Toolbox documentation from here.

カテゴリ

質問済み:

2021 年 1 月 4 日

回答済み:

2021 年 1 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by