473,385 Members | 1,753 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,385 software developers and data experts.

Refreshing datagridview contents after a failed delete in bound datagridview

Bob
I have relational integrity set up in my sql server 2005 database that
prevents cascading deletes in some cases.
I'm using a bound datagrid view and a tablenavigator. When I click the
delete button on it then the save button, I get the message saying a foreign
key constraint does not allow the deletion, but the row is no longer shown
in the datagridview. Only way I get to see it is to close my form and open
it again, then row is there OK.

Question is how do I refresh the datagridview after such a failed delete.

I can think of doing the checking to see if there are any child records in
the UI code UserDeletingRows event of the datagrid, then issuing a Cancel so
that the UI prevents the deletion, but that sort of circumvents the purpose
of letting your database doing the integrity checking.

Can anyone give me an idea on how to detect that a delete has failed using
these controls , I know how to do a refill. I just need to know what event
to use to launch it.

Any help appreciated,

Bob

Jan 5 '06 #1
0 1315

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

Similar topics

0
by: thomasp | last post by:
This is a two part question, 1) The code below should display a form with a datagridview and a few command buttons. This form should allow the user to make change to the records displayed in...
0
by: Vico | last post by:
Hi! I have this scenario: I have a windows form. I have a DataGridView Control which is bound to a DataSource. Under the DataGridView I have texboxes which represent each one of the columns in...
1
by: Steve | last post by:
I have a bound DataGridView. When I add an item to the DataSource, the DataGridView won't reflect the new row. I have googled and googled, no solution that I have found online works. One thing...
3
by: steve | last post by:
Hi All How can I get the datagridview to redraw after changing the rowtemplate.height at runtime ( it is databound to a datatable) I have tried datagridview1.refresh etc to no avail (The row...
0
by: lv2compute | last post by:
I am having a problem with my datagridview. I have a small table that has two columns. The first column is bound to my dataset. The second column is a combobox. I add items to the combobox based on...
2
by: GS | last post by:
seems to me both requires extra coding to do update to data bind form sql adapter. however it is easier to customize the column width for datagridview. for best practise which one should one use...
6
by: =?Utf-8?B?TU1TSkVE?= | last post by:
How to let user delete multi rows from the BindingSource while the SelectionMode Property set to RowHeaderSelect I have in my program datagridview bound it to sql table Throw Bindingsource To...
0
by: enrico via DotNetMonster.com | last post by:
as a way of refreshing my datagridview i rerun my query after every command. on my delete button i use the same procedure but as a result it will clear all the results. can anyone help me how to...
1
by: Avedo | last post by:
Hello! I have a form application with a DataGridView, and an Save/Delete and Cancel button. When the application is opened, it is supplied an XML file that may or may not exist, and display the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...

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.