POR RAZON FUERA DE MI ALCANCE SE INGRESARON DATOS DUPLICADOS EN LA BD TRATO DE ENVIAR UNA ALERTA CUANDO SE DETECTA QUE EL DATO ES DUPLICADO , con esta consulta trato de ver los duplicados
Private Function BuscarDuplicado() As DataTable
Try
Dim t As New DataTable
Dim sql As String = "SELECT * FROM Tabla1 columna1 WHERE Columna1 = '" & Me.Txtduplicado.Text & "'"
Dim da As New SqlDataAdapter(sql, conex)
conex.Open()
da.Fill(t)
Return t
' conex.Close()
Catch ex As Exception
MsgBox(ex.Message)
Finally
conex.Close()
End Try
End Function
ACA DONDE MANDO LA ALERTA PERO ALGO ANDO HACIENDO MAL POR QUE ME TIRA ALERTA EN TODOS LOS DATOS SUPONGO QUE MI COSULTA ESTA MAL
Dim t1 As DataTable
t1 = Me.BuscarParteDescripcion()
If t1.Rows.Count = 0 Then
' MessageBox.Show("DatoRepetido", "Verificacion de Dato", MessageBoxButtons.OK, MessageBoxIcon.Stop)
Else
' MsgBox("Dato Repetido Verificar")
MessageBox.Show("Dato Repetido", "Verificacion de Dato", MessageBoxButtons.OK, MessageBoxIcon.Stop)
End If
End Sub