1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| Public Function GetCAStockProgramme(ByVal idProgramme As Integer) As DstCAStockProg
'variables
Dim oDstCAStockProg As New DstCAStockProg
Dim StrSql As String
Dim MySqlCmd As MySqlCommand
Dim MySqlDAdapt As New MySqlDataAdapter
Dim MySqlCn As New MySqlConnection(gcnx)
'Requete Sql
StrSql = " select programme.idProgramme as idProgramme, programme.nom as ProgrammeNom, ensembles.id as idEnsemble, ensembles.nom as EnsembleNom, residences.id as idResidence, residences.nom as ResidenceNom, count(lot.idLot) as NbLots, sum(if(idStatut=4,1,0)) as NbStatutActe, sum(if(idStatut=4,montantTtc,0)) as montantTtcActe,sum(if(idStatut <>4 and idStatut>0,1,0)) as NbStatutLibre, sum(if(idStatut<>4 and idStatut>0,montantTtc,0)) as montantTtcLibre "
StrSql &= " from ensembles left join programme on programme.idProgramme=ensembles.idProgramme "
StrSql &= " left join residences on ensembles.id=residences.idEnsemble "
StrSql &= " left join lot on residences.id=lot.idResidence "
StrSql &= " left join statutlot on lot.idStatut=statutlot.idStatutLot "
StrSql &= " where programme.idProgramme = " & idProgramme
StrSql &= " group by idEnsemble, idResidence "
'ouverture de la connexion
MySqlCn.Open()
MySqlCmd = New MySqlCommand(StrSql)
MySqlCmd.Connection = MySqlCn
MySqlDAdapt.SelectCommand = MySqlCmd
oDstCAStockProg.Clear()
MySqlDAdapt.Fill(oDstCAStockProg, "CAStockProg")' l'erreur se fait ici
'fermeture de la connexion
MySqlCn.Close()
Return oDstCAStockProg
End Function |
Partager