How to remove records from CSV in C#? -


i'm trying remove records csv formatted text file. here code reading , inserting records:

    oledbconnection con = new oledbconnection();     con.connectionstring = constr;     con.open();     oledbcommand com = new oledbcommand();     com.connection = con;     com.commandtext = "select * shop.txt id '" + textboxsearch.text + "%'";     oledbdataadapter da = new oledbdataadapter(com);     dataset ds = new dataset();      da.fill(ds);     com.executenonquery();     datagridview1.datasource = ds.tables[0].defaultview;     con.close(); 

but dont work remove. remove query this: delete * shop.txt id <something>

note: when calling executenonequery following exception occurred

oledbexception: deleting data in liked list not supported in isam.

deleting rows textfile not easy - ole adapter doesn't support it. options:

  • select data want keep datatable , export csv file.
  • parse csv file, filter unwanted lines , write other lines csv file. might bit faster using ole load data memory , dump them out.

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -