Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 25th, 2005, 03:08 PM
Authorized User
 
Join Date: Mar 2004
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to do this??????Urgent

 am showing a database table in a datagrid. I have added a delete event in it. can any one tell me how do i get the value of the cell of the selected row. For example, i am showing value in grid like:
Delete ID Name Address
[u]Delete</u> 1 A abc st.
[u]Delete </u> 2 B xyz st.
[u]Delete</u> 3 C lll ave

In the above scenario, how do i get the value 1 when user clicks on the delete button for the first row

thanks
 
Old August 29th, 2005, 11:40 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

u have e (DataGridCommandEventArgs) in DeleteCommand of ur DataGrid.
to get the Index item of Selected Delete u can use
Code:
e.Item.ItemIndex
HTH.

Always:),
Hovik Melkomian.
 
Old August 30th, 2005, 07:42 PM
Authorized User
 
Join Date: Mar 2004
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This will give you the row index, but i need the value of ID field in order to delete it from database. any suggestions
 
Old August 31st, 2005, 07:24 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

so use this code in ur DeleteCommand function
Code:
dataSet_Name.table_Name.Rows[e.Item.ItemIndex].Delete();
HTH.

Always:),
Hovik Melkomian.





Similar Threads
Thread Thread Starter Forum Replies Last Post
urgent deb_kareng ASP.NET 2.0 Professional 1 August 13th, 2007 07:29 AM
it's urgent deb_kareng ASP.NET 2.0 Professional 3 August 7th, 2007 07:40 AM
urgent help yash_coolbuddy_forindia BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 1 May 7th, 2007 08:40 AM
urgent???????????? nsr35 Beginning VB 6 1 October 3rd, 2005 10:57 AM
urgent ??????????????? nsr35 Pro VB Databases 0 October 3rd, 2005 04:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.