Matlab and Access
1 次查看(过去 30 天)
显示 更早的评论
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!
0 个评论
回答(1 个)
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
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Database Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!