predicting whether a row may be deleted beforehand

  • Thread starter Thread starter Craig Douglas
  • Start date Start date
C

Craig Douglas

Hi,

I am using a datagrid to edit a SQL Server database table.

I have put a delete button on the row, such that records can be deleted.

I need the disable the delete button (set visibility = false) for each item
in the row which is referenced by another item in the database.

Does anyone know how I could effectively predict whether a row can be
deleted or not before trying?

Thanks for reading!

Craig
 
U¿ytkownik "Craig Douglas said:
Hi,

I am using a datagrid to edit a SQL Server database table.

I have put a delete button on the row, such that records can be deleted.

I need the disable the delete button (set visibility = false) for each
item
in the row which is referenced by another item in the database.

Does anyone know how I could effectively predict whether a row can be
deleted or not before trying?

I suppose that you must prepare own special Select statement to fill
dataset, for example:

Select
*,
Exists(Select *
From
Invoices As I
Where
C.CustId = I.CustId)
As HasInvoices
From
Customers As C

Regards,
Grzegorz
 
Grzegorz Danowski said:
U¿ytkownik "Craig Douglas" <[email protected]> napisa³ w
wiadomo¶ci news:[email protected]...

I suppose that you must prepare own special Select statement to fill
dataset, for example:

Select
*,
Exists(Select *
From
Invoices As I
Where
C.CustId = I.CustId)
As HasInvoices
From
Customers As C

Regards,
Grzegorz
Thanks Grzegorz,

I implemented it as a view, and bound the grid to the view, such that I
could retain the existing update, delete and insert functionality.

Kind regards,

Craig
 
Back
Top