Click here to Skip to main content
15,905,686 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

Currently i am binding the dataset to Component 1 true dbgrid using datasource property.I want the steps to bind it in similar way programmatically.

Once the data is bound to the grid i will select the row and press on delete key and it has to delete the row from the database and also from the grid. Currently i enabled Allow delete option which is deleting the row from the grid but not from the database.

Please Suggest the steps so that i can bind the data to the Component 1 true dbgrid programatically and delete a row using delete key.

thanks in advance.
Posted
Comments
Sunasara Imdadhusen 13-Jun-13 7:48am    
Have you started development?
anupama962010 13-Jun-13 8:45am    
yes i have.. but i am not getting the required result.

1 solution

The method is as follows:
Assuming that when you bind the gridview all rows contains an Id (means primary key)
create a query to delete a row from table in db by accepting a Id

while you click on the delete button

you can get the id as:
datagridview1.CurrentRow.Cells["Id"].Value.ToString());
then pass the above id to the query
then rebound the datagrid from db
 
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