Delete an Item (Row) from Access Database C# Visual Studio -
i'm trying program delete button delete row when it's selected. yet, find on internet bunch of _ _ _ _
i creating program on visual studio 2010 professional. using ms access database
the form contains multiple list-boxes, each own piece of row data.
i can add rows table through programs gui, cannot seem delete them!
i want delete selected item, , delete rows on-click of different button.
thanks
note: not using sql before decide give me answers in sql..
it should "something" this:
dbnamedataset.tablename deltablenamerow; deltablenamerow = dbnamedataset.findbyitemid( selecteditem.lstid ); deltablenamerow.delete(); this.tablenametableadapter.update(this.dbnamedataset.tablename);
however, skills in c# limited, can write pseudo obstacles. have mind figure out problems, not library of termanology , understood language write myself @ moment.
please can figure out me.
this how add items (working):
dbokanadadataset.productsrow newproductsrow; newproductsrow = dbokanadadataset.products.newproductsrow(); newproductsrow.productname = txtitem.text; newproductsrow.listprice = txtprice.text; this.dbokanadadataset.products.rows.add(newproductsrow); this.productstableadapter.update(this.dbokanadadataset.products);
any contributions welcome.
muchas gracias, merci, danke, xie4 xie4, thanks! josh.
i have found solution (it's not quite wanted, working task.)
using 'binding navigator' tool found in toolbox.
it give user following bar:
then, double-click 'save' button , add code form:
private void savetoolstripbutton_click(object sender, eventargs e) { saverow(); } public void saverow() { // created separate function can called later // ... simple 'saverow();' call. (removes code repetition) // note: '55555' , '66666' replaced // ... dataset names (55555) , table name (66666) this.validate(); this.55555bindingsource.endedit(); this.55555tableadapter.update(55555dataset.66666); }
to remove items, double-click 'delete' icon , add following line of code:
{ saverow(); }
Comments
Post a Comment