Hola, estoy haciendo una aplicacion en la cual puedo buscar informacion en una tabla de  acuerdo a la seleccion de los drops cargo solicitado y profesion
 
la aplicacion realiza la busqueda si se selecciona uno de los dos parametros o los dos.
 
pero a la hora de mostrarme los resultados de la busqueda en el datagrid
 
me muestra los registros repetidos y no se como corregir eso, es decir cada regidtro de la base de datos lo muestra varias veces seguidas en las lineas del grid
 
abajo dejo mi codijo desarrollado
 
<script language="VB" runat="server">
  Sub Page_Load(Sender As Object, E As EventArgs)
 
   Dim  MyConnection As SqlConnection
   MyConnection = New SqlConnection("SERVER=MDS01; DATABASE=be; INTEGRATED SECURITY=false;PASSWORD=sa;USER=sa")
 
         If Not IsPostBack 
 
         Dim ds As DataSet 
 
         Dim MyCommand As SqlDataAdapter
 
          MyCommand = New SqlDataAdapter ("select CargoID, Nombre_Cargo from Cargo_Solicitado" , MyConnection)
 
           ds = New DataSet () 
 
         MyCommand.Fill(ds,"Cargo_Solicitado")
 
     DropDownList1.DataSource = ds.Tables("Cargo_Solicitado").DefaultView
     DropDownList1.DataTextField = "Nombre_Cargo"
     DropDownList1.DataValueField ="CargoID"
     DropDownList1.DataBind()
     DropDownList1.Items.Insert(0, "Seleccione un item")
     DropDownList1.SelectedIndex = 0
 
     Dim dc As DataSet 
     Dim MyCommand2 As SqlDataAdapter
     MyCommand2 = New SqlDataAdapter ("select ProfesionID, Nombre_Profesion from Profesion", MyConnection)
     dc = New DataSet () 
          MyCommand2.Fill(dc,"Profesion")
 
          DropDownList2.DataSource = dc.Tables("Profesion").DefaultView
          DropDownList2.DataTextField = "Nombre_Profesion"
          DropDownList2.DataValueField = "ProfesionID"
          DropDownList2.DataBind()
          DropDownList2.Items.Insert(0, "Seleccione un item")
          DropDownList2.SelectedIndex = 0
     end if
     end sub
 
     Sub Button1_click (sender As Object, e As EventArgs)
 
        Dim SelectCommand As String = "select *, Nombre_Cargo, Nombre_Profesion from SolicitudEmpleo, Cargo_Solicitado, Profesion"
     If DropDownList1.SelectedIndex then
 
       SelectCommand += " WHERE SolicitudEmpleo.Cargo_Solicitado = Cargo_Solicitado.Nombre_Cargo"
       SelectCommand += " AND SolicitudEmpleo.CargoID= Cargo_Solicitado.CargoID"
       SelectCommand += " AND SolicitudEmpleo.CargoID=" &DropDownList1.SelectedItem.Value
         bingrid (SelectCommand)
 
     else if DropDownList2.SelectedIndex then
 
       SelectCommand += " Where SolicitudEmpleo.Profesion= Profesion.Nombre_Profesion"
       SelectCommand += " AND SolicitudEmpleo.ProfesionID= Profesion.ProfesionID"
       SelectCommand += " AND SolicitudEmpleo.ProfesionID=" &DropDownList2.SelectedItem.Value
        bingrid (SelectCommand)
      Else if DropDownList1.SelectedIndex and DropDownList2.SelectedIndex then
 
       SelectCommand += " WHERE SolicitudEmpleo.Cargo_Solicitado = Cargo_Solicitado.Nombre_Cargo"
       SelectCommand += " AND SolicitudEmpleo.Profesion= Profesion.Nombre_Profesion"
       SelectCommand += " AND SolicitudEmpleo.ProfesionID= Profesion.ProfesionID"
       SelectCommand += " AND SolicitudEmpleo.CargoID= Cargo_Solicitado.CargoID"
       SelectCommand += " AND SolicitudEmpleo.CargoID=" &DropDownList1.SelectedItem.Value
       SelectCommand += " AND SolicitudEmpleo.ProfesionID=" &DropDownList2.SelectedItem.Value
       bingrid (SelectCommand)
       end if
 
     end sub
 
     Sub bingrid(SelectCommand as string)
        Dim DS As DataSet
        Dim MyConnection As SqlConnection
        Dim MyCommand As SqlDataAdapter
 
        MyConnection = New SqlConnection("SERVER=MDS01; DATABASE=be; INTEGRATED SECURITY=false;PASSWORD=sa;USER=sa")
        MyCommand = New SqlDataAdapter(SelectCommand, MyConnection)
 
        DS = new DataSet()
        MyCommand.Fill(DS, "SolicitudEmpleo")
 
        MyDataGrid.DataSource=DS.Tables("SolicitudEmpleo")  .DefaultView
        MyDataGrid.DataBind()
 
     end sub
		</script> 
  
 
 
 aunque le hice un ajustillo 
 
 
 
 
