Click here to Skip to main content
15,883,938 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to display all the duplicate data in this gridview. But, i dont have any idea on how it works. What i have tried seem not working at all. Mind to share any ideas?

What I have tried:

Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        Dim cn As String = 
        ConfigurationManager.ConnectionStrings("zzzzz").ConnectionString
        Using cs As New SqlConnection(cn)
        Using cmd As New SqlCommand("SELECT xxxxx, COUNT(*) FROM vvvvv GROUP BY xxxxx HAVING COUNT(*) > 1", cs)
                Using sda As New SqlDataAdapter(cmd)
                    Dim dt As New DataTable()
                    sda.Fill(dt)
                    rptTableUser3.DataSource = dt
                    rptTableUser3.DataBind()
                End Using
            End Using
        End Using

    End Sub
Posted
Comments
Maciej Los 21-Oct-20 3:15am    
What's wrong with your code?
syuhaiba hamizi 21-Oct-20 4:04am    
im getting error (( DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'id'. )) 'id' is my primary key. How am i gonna solve this error?
Maciej Los 21-Oct-20 4:19am    
Based on the small portion of information you provided - i have no idea how to help you.
[no name] 21-Oct-20 16:28pm    
You use your "counting" query to drive another select for the duplicates (join or in).
syuhaiba hamizi 21-Oct-20 23:13pm    
can you give some example?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900