0

The code below checks for unapproved pledges in a table and notifies the user if there are unapproved pledges.However,i would like to display all the unapproved PledgeIDs to the user through a message box. Kindly assist

sql = "SELECT PledgeID FROM tblpledges WHERE Status=@status"
        command = New OleDbCommand(sql, connection)
        command.Parameters.Add(New OleDbParameter("@status", OleDbType.VarChar)).Value = "Unapproved"
        reader = command.ExecuteReader
        If reader.HasRows Then
            errmsg = "You Have Some Unapproved Pledges"
        End If

        If errmsg <> "" Then
            MessageBox.Show(errmsg)
            Return False
        Else
            Return True
        End If
0

1 Answer 1

3

Modify your code to :

Dim pledgeIDs As New List(Of String) 'Add this
If reader.HasRows Then
    Do While reader.Read()
       pledgeIDs.Add(reader.GetString(0))          
    Loop
    MessageBox.Show("You Have Some Unapproved Pledges : " & String.Join(",", pledgeIDs))
End If
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.