Salut tout le monde,

mon code:

partie ASP

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<%
'Recuperation de l'id grace a Session
dim idcandidat
idcandidat=Session("idd")
 
Dim conn As New MySql.Data.MySqlClient.MySqlConnection
Dim Cmde As MySql.Data.MySqlClient.MySqlCommand
Dim myConnectionString,mySelectQuery as String
 
 
myConnectionString = "server=localhost;" _
& "uid=root;" _
& "pwd=;" _
& "database=teamlab;"
conn.ConnectionString = myConnectionString
conn.Open()
 
'Recuperation Projet (Tite & Description)
 
mySelectQuery = "SELECT * FROM `projects_project_participant`,`projects_projects` WHERE `projects_project_participant`.`participant_id` = '" & idcandidat & "' AND `projects_project_participant`.`project_id` = `projects_projects`.`id`"
Cmde = New MySql.Data.MySqlClient.MySqlCommand()
 
With Cmde
.Connection = conn
.CommandText = mySelectQuery
End With
 
Try
Cmde.ExecuteNonQuery()
DIM dr = Cmde.ExecuteReader
dim i=0
 
If dr.HasRows Then
If Not Page.IsPostBack Then
 
While dr.Read
i=i+1
 
projet.Text = projet.Text & "Projet n " & i & ":<br><br>" & "Titre du projet: "& dr("title") &"<br>Description du projet: "& dr("description") & "<br><br>"
 
End While
End If
End If
dr.Close()
Catch ex As Exception
lblText.Text = "Record Cannot Insert : Error (" & ex.Message & ")"
End Try
 
'Recuperation de TASK (Titre & Description)
 
mySelectQuery = "SELECT * FROM `projects_project_participant`,`projects_tasks`WHERE `projects_project_participant`.`participant_id` = '" & idcandidat & "'AND `projects_project_participant`.`project_id` = `projects_tasks`.`id`"
Cmde = New MySql.Data.MySqlClient.MySqlCommand()
 
With Cmde
.Connection = conn
.CommandText = mySelectQuery
End With
 
Try
Cmde.ExecuteNonQuery()
 
DIM dr = Cmde.ExecuteReader
If dr.HasRows Then
If Not Page.IsPostBack Then
While dr.Read
 
task.Text = task.Text & "Titre de la tache: " & dr("title") & "<br>Description de la tache: " & dr("description")& "<br>"
 
End While
End If
End If
dr.Close()
Catch ex As Exception
lblText.Text = "Record Cannot Insert : Error (" & ex.Message & ")"
End Try
 
 
 
Cmde = Nothing
conn.Close()
conn = Nothing
%>
Partie html

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
<asp:Label id=projet runat="Server"></asp:Label>
<asp:Label id=task runat="Server"></asp:Label>
Le probleme:

J'ai deux projets donc aussi 2 taches ce qui affiche:

projet titre 1, projet description 1, projet titre 2, projet description 2
task titre 1, task description 1, task titre 2, task description 2

Ce que je souhaite afficher:

projet titre 1, projet description 1, task titre 1, task description 1
projet titre 2, projet description 2 , task titre 2, task description 2

Vous voyez ???