c# - Writing into excel file with OLEDB -


does know how write excel file (.xls) via oledb in c#? i'm doing following:

   oledbcommand dbcmd = new oledbcommand("create table [test$] (...)", connection);    dbcmd.commandtimeout = mtimeout;    results = dbcmd.executenonquery(); 

but oledbexception thrown message:

"cannot modify design of table 'test$'. in read-only database."

my connection seems fine , can select data fine can't seem insert data excel file, know how read/write access excel file via oledb?

you need add readonly=false; connection string

provider=microsoft.jet.oledb.4.0;data source=fifa_ng_db.xls;mode=readwrite;readonly=false;extended properties=\"excel 8.0;hdr=yes;imex=1\"; 

Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -