locked
I need Urgent Help using Sql data source in my ASP page RRS feed

  • Question

  • User-431814568 posted

    can somebody tell me how to delete child records in the first step

    check if there is no more child using count row number  if = 0  delete the key in parent table


    parent table must have always child records in my case



    by Using sql data source Delete tab



    Saturday, December 4, 2010 5:44 AM

Answers

  • User1693490991 posted

    SET NOCOUNT ON;
    Set @OrderIDinChildTable = (Select order_dtl_id from ChildTable where (IDChild = @IDChild));
    DELETE FROM Child WHERE (IDChild = @IDChild)
    IF (SELECT count(*) FROM  Child WHERE order_dtl_id =@OrderIDinChildTable) =0
    BEGIN
       delete from order_dtl where order_dtl_id= @OrderIDinChildTable 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, December 5, 2010 2:46 PM

All replies