필터 지우기
필터 지우기

??? Invoke Error, Dispatch Exception: Source: DAO.Database

조회 수: 4 (최근 30일)
Amir Hamzah UTeM
Amir Hamzah UTeM 2011년 4월 11일
??? Invoke Error, Dispatch Exception: Source: DAO.Database Description: Syntax error in INSERT INTO statement. Help File: jeterr40.chm Help Context ID: 4c577e Error in ==> getrecords at 11 invoke(db,'Execute',x);
cn=actxserver('Access.application');
db=invoke(cn.DBEngine,'OpenDatabase', 'C:\test.mdb');
rs=invoke(db,'OpenRecordset','Table1');
fieldlist=get(rs,'Fields');
ncols=get(fieldlist,'Count');
for c=1:double(ncols)
fields{c}=get(fieldlist,'Item',c-1);
resultset.columnnames{c}=get(fields{c},'Name');
end;
x='INSERT INTO Table1 (percent,value) VALUES (33,"abcdefg")';
invoke(db,'Execute',x);
invoke(rs,'Close');
invoke(db,'Close');
delete(cn);
what i'm doing wrong? can someone expert repair my code correctly? i'm lack of knowledge about DB..here my code Thanks Amir

답변 (1개)

Walter Roberson
Walter Roberson 2011년 4월 11일
x='INSERT INTO Table1 (percent,value) VALUES (33,''abcdefg'')';
That is, the syntax for an SQL string is quoting with apostrophes, not with double-quotes. In order to indicate that you want an apostrophe in a MATLAB string, use two apostrophes in a row.

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by