在消息框vb.net

时间:2017-08-21 07:33:07

标签: arrays vb.net

下面的代码检查表中未批准的承诺,并通知用户是否有未批准的承诺。但是,我想通过消息框向用户显示所有未批准的PledgeID。请帮助

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

1 个答案:

答案 0 :(得分:0)

将您的代码修改为:

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