c# - syntax error in insert into mdb -



c# - syntax error in insert into mdb -

i write string insert mdb file in c#, error "syntax error in insert statment" catched in code. test string straight in microsoft access 2007 , query inserted no error.

string qu = "insert reports ( docid, biopsy, normal, section, subsection, title, items, [text] ) values (21, false, false, 'recommendation', 'a', 'injection', 'a', 'a');"; oledbcommand cmd = new oledbcommand(); oledbdataadapter da = new oledbdataadapter(); dataset ds = new dataset(); oledbconnection con = model.getdataconnection(); cmd.connection = con; cmd.commandtext = qu; con.open(); seek { cmd.executenonquery(); } grab (exception ex) { system.windows.forms.messagebox.show("data error!\n" + ex.message); homecoming false; }

the original string shows right bracketing, prior unfortunate edit.

string qu = "insert reports ( docid, biopsy, normal, [section], subsection, title, items, [text] ) values (21, false, false, 'recommendation', '', 'injection', '', '');";

reports, section, , text reserved words. enclose them in brackets in sql statement.

insert [reports] ( docid, biopsy, normal, [section], subsection, title, items, [text]) values ( 21, false, false, 'recommendation', 'a', 'injection', 'a', 'a');

c# sql visual-studio-2010 ms-access ms-access-2007

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -