473,405 Members | 2,160 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

datagrid editing

I have a datagrid with a 'Delete' column that the user can click on to
delete a row in the datagrid. I thought that I would need to have some
kind of error handling in case somebody goes into the database table
that the datagrid uses and deletes a record while the user is still
viewing the record in their datagrid, since if they then press 'Delete'
on a record that has since been deleted from the table, a concurrency
error should occur. But after trying this, no error is raised at all,
on pressing 'Delete' the record is simply removed from the datagrid.
Does anybody know why this happens? And do I therefore not need to
provide error handling for this?
Cheers,

Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #1
3 1714
most likely you have removed the record from the datagrid or the underlaying
dataset and then not bound back to the database table.

you need to delete from the database table and the rebind the datagrid.

if you are deleting from the database using a command such as

"Delete from mytable where record=deletevalue"

and this record does not exist in the db then you will not get an error. It
is best to check the rowcount property (usually in the db) to actually
ensure that 1 row was deleted.
although you may think not deleting a row is an error, the database does
not.

hope I have understood you correctly.

cheers

martin

"Mike P" <mr*@telcoelectronics.co.uk> wrote in message
news:O$**************@TK2MSFTNGP11.phx.gbl...
I have a datagrid with a 'Delete' column that the user can click on to
delete a row in the datagrid. I thought that I would need to have some
kind of error handling in case somebody goes into the database table
that the datagrid uses and deletes a record while the user is still
viewing the record in their datagrid, since if they then press 'Delete'
on a record that has since been deleted from the table, a concurrency
error should occur. But after trying this, no error is raised at all,
on pressing 'Delete' the record is simply removed from the datagrid.
Does anybody know why this happens? And do I therefore not need to
provide error handling for this?
Cheers,

Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 17 '05 #2
Martin,

I just wondered if I should be getting an error even though I wasn't.
I'm using direct SQL 'DELETE * FROM Table WHERE ID = ", so if this isn't
actually meant to generate an error, it is probably OK to leave my code
as it is...there's no need to inform the user that the record was
deleted by somebody else, as long as it is deleted.
Thanks,

Mike
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #3
Correct..
"Mike P" <mr*@telcoelectronics.co.uk> wrote in message
news:uN**************@TK2MSFTNGP12.phx.gbl...
Martin,

I just wondered if I should be getting an error even though I wasn't.
I'm using direct SQL 'DELETE * FROM Table WHERE ID = ", so if this isn't
actually meant to generate an error, it is probably OK to leave my code
as it is...there's no need to inform the user that the record was
deleted by somebody else, as long as it is deleted.
Thanks,

Mike
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Junkguy | last post by:
I need some help programmatically causing a row in a DataGrid to "flush" its contents to its bound data (in Visual Studio 6 using Windows Forms with C#). My issue is I want to send an update to...
3
by: Bill C. | last post by:
Hello, I know this has been discussed a lot already because I've been searching around for information the last few weeks. I'm trying to implement a DataGridComboBoxColumn class. I've found...
3
by: Zürcher See | last post by:
Someone has implemented a Datagrid Button for the Windows.Form?
0
by: Paolo Tardivel via DotNetMonster.com | last post by:
I have a databound datagrid containing template columns which allow editing of the values contained in the datagrid through the use of text boxes. One of the fields in the datagrid displays the...
3
by: Islamegy | last post by:
When i press btn_save all changed rows in my grid get saved except the last editing row... I want my btn_Save to end editing in the datagrid.. so if user didn't press "enter" after editing last...
9
by: tshad | last post by:
Is there a way to use your own image in place of the automatic one that ASP uses when doing editing in your DataGrid pages? We already have a style of button we are using and would like to be...
2
by: Sharon | last post by:
I want put into my DataGrid different control types in the same column. For example: Column 1, row 0 ==> TextBox Column 1, row 2 ==> CheckBox Column 1, row 2 ==> ComboBox etc... As I see, I...
8
by: =?Utf-8?B?bWlrZWc=?= | last post by:
Hi, I am building a small Help Desk application for my company and need to be able to edit "open" help desk issues. I use a simple datagrid to display each issue (6 per page) , with an Edit...
0
by: hanusoft | last post by:
This is an example of editing in DataGrid and Default Paging http://www.hanusoftware.com Html Design Code : - <asp:DataGrid id="DataGrid1" DataKeyField="id" runat="server" Height="224px"...
2
by: jock1up | last post by:
I am working with editing within a DataGrid control cell and am confused about which events occur after the editing is completed. I see that 5 events can occur total, including the ones below and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.