Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want to add new row to datagrid and the same will be added to database.
in whice event i shouild write .what r the code possibilties
Posted

Yes you can. Simple create a new row like
DataRow row = mydataset.NewRow();

and assign values to this row.
mydataset.acceptchanges();
and all done.
 
Share this answer
 
Bad question. Which kind of database? What kind of data? Add row through code or UI? What do you have so far? Are you using binding? Are you using any ORM tools? What Events of what Controls are you talking about? What answer do you expect. If you do not know what you want then how should we?
You can start by Googling DataGridView[^] and stuff like DbConnection[^], DbCommand[^], DbDataAdapter[^], DbDataReader [^]and DbTransaction[^]. Or maybe the Entity Framework[^] or nHibernate[^] are more your cup of tea?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900