test if input entered by user is exist in database or not

조회 수: 2 (최근 30일)
Han
Han 2018년 1월 31일
답변: Walter Roberson 2018년 1월 31일
Hi !
I try the following code on a single record and it's work now I have a table with employees id I want to test if the number entered by user is exist so he can sign in my system
Code:
a = get(handles.ID,'String');
conn = database.ODBCConnection('users','root','root');
x = exec(conn,'select ID from employee');
x = fetch(x);
x1=(x.Data);
L1 = strcmp(a,x1);
if L1 == 1
.
end
Please Can you HELP ME !

채택된 답변

Walter Roberson
Walter Roberson 2018년 1월 31일
x = exec(conn, sprintf('select ID from employee where ID=''%s''', a));

추가 답변 (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