Matlab and Access

조회 수: 1 (최근 30일)
Ankit
Ankit 2012년 4월 4일
curs = exec(conn,['delete from attendance where eid = ' '''' eid12 ''' & entry= ' '''' dt ''''])
I m trying to run the above statement but i m not getting any output. I tried executing it without putting the & sign and got an output. So there is an error in the AND operator.
Please help with the proper syntax!

답변 (1개)

Leah
Leah 2012년 4월 4일
It would help to have the error message but if eid12 and dt are numbers (doubles) you have to convert them to strings. Also you need to use "and" instead of "&"
curs = exec(conn,['delete from attendance where eid = ' '''' num2str(eid12) ''' and entry= ' '''' num2str(dt) ''''])
you can always test to make sure you have correctly written your queries by looking at the string on the command line, just try executing
['delete from attendance where eid = ' '''' eid12 ''' & entry= ' '''' dt '''']
Then try mine
['delete from attendance where eid = ' '''' num2str(eid12) ''' and entry= ' '''' num2str(dt) '''']
notice the difference
  댓글 수: 1
Ankit
Ankit 2012년 4월 5일
hey , thanks for replying.
i found the solution. my query was correct. there was just some incompatibility in the data passed and the data type of the columns in the database.

댓글을 달려면 로그인하십시오.

카테고리

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