locked
Delete Unchecked items of CheckedListBox from Database in Windows Forms Application RRS feed

  • Question

  • have a checkbox list in windows application
    i am able to select the data items from checkbox list which is populated from database.
    & able to save the checked items in a table
    but not able to uncheck the checked items & remove from the database


    code 


    For i As Integer = 0 To checkedlist1.Items.Count - 1
                           
    If Not checkedlist1.CheckedItems.Contains(checkedlist1.Items(i)) Then
     
                               
    Dim cmddelete As New SqlCommand("usp_deletecheckedPrdt", conn)
                                cmddelete
    .CommandType = CommandType.StoredProcedure
                                cmddelete
    .Parameters.AddWithValue("@ppid", SqlDbType.Int).Value = CInt(checkedlist1.CheckedItems.Item(i)("pid"))
                                cmddelete
    .ExecuteNonQuery()
                           
    End If
                       
    Next
    SP = 

     

    if exists(Select * from prdt_taken where pid=@ppid)

    delete from prdt_taken where pid=@ppid


    svk

    Saturday, November 17, 2012 3:10 PM

All replies

  • I don't see the code where you compare the old checked items and the current checked items to find out which item is unchecked. Anyway you probably want to move to a Windows Forms forum, this forum is for Windows's security APIs and people here are less likely to use .Net.


    Visual C++ MVP

    Tuesday, December 4, 2012 2:12 AM