Reputation: 1
query = "select c.idEmp, c.idEtat, c.idNiveauValidation," & _
" c.niveauDejaValider ,T.idTypeD , " & _
"s.idEmp , s.idNiveauValidation ,s.niveauDejaValider " & _
" from TypeDemande T " & _
"INNER JOIN DemandeConge c on c.idTypeD = T.idTypeD " & _
"INNER JOIN DemandeSalaire s on s.idTypeD = T.idTypeD " & _
"WHERE (c.idTypeD= " & ddlTypeDemande.SelectedValue & " ) OR ( s.idTypeD=" & ddlTypeDemande.SelectedValue & ")"
sqlCon.Open()
Dim sqlCmd As New SqlCommand(query, sqlCon)
Dim sqlAdap As New SqlDataAdapter(sqlCmd)
Dim ds As New DataSet
Dim dt As New DataTable
sqlAdap.Fill(ds, "TypeDemande")
dt = ds.Tables("TypeDemande")
Dim n As Integer
n = dt.Rows.Count
If n > 0 Then
the number of row return is always "0"
Upvotes: 0
Views: 57
Reputation: 3809
Because you are using INNER JOINS
, you won't get any records if there aren't corresponding rows in all three tables.
In other words, if either of the tables DemandeConge and DemandeSalaire have missing data that match what you are selecting, you'll get 0 rows returned.
To check this, try changing the INNER JOIN
to LEFT JOIN
and see if your data appear.
Upvotes: 1