Bonjour
j'ai mi une requete select dans une procedure stockée, après avoir fait des MAJ de la BD, et je voulais recuperer les valeurs de select, mais elle m'envoie aucune valeur:
voici le code:
Code sql : 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 ALTER PROCEDURE dbo.mat_etudiant @pro nvarchar(5) , @ann nvarchar(12), @mat int output, @n nvarchar(70) output, @p nvarchar(70) output AS declare @t as table ( id int not null IDENTITY , id_etudiant int not null, nom_etudiant VARCHAR(64) not null , PRIMARY KEY (id)) insert into @t(id_etudiant, nom_etudiant) select e.id_etudiant, e.nom from etudiant as e join scolarite as s on e.id_etudiant=s.id_etudiant join promotion as p on s.id_promotion=p.id_promotion join annee_academique as a on s.id_annee=a.id_annee where p.promotion=@pro and a.annee_academique=@ann and e.affecte_matricule=0 order by e.nom insert into matricule(id_etudiant, matricule,nouveau) select id_etudiant, CAST(@pro AS VARCHAR(2)) + SUBSTRING('00', 1, 2 - LEN(CAST(id AS VARCHAR(03)))) + CAST(id AS VARCHAR(03)),1 from @t update etudiant set affecte_matricule=1 where affecte_matricule=0 --update nouveau set finish=1 where finish=0 update matricule set nouveau=1 select @mat=matricule, @n=nom, @p=prenom from matricule m, etudiant e where m.id_etudiant=e.id_etudiant and m.nouveau=1
code sur vb.net:
pourriez vous, svp, m'aider
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 Dim cmd As SqlCommand = New SqlCommand() cmd.Connection = con cmd.CommandType = CommandType.StoredProcedure cmd.CommandText = "matricule_nv_etudiant" With cmd.Parameters .Add(New SqlParameter("@pro", CStr(cmb_promotion.SelectedItem))) .Add(New SqlParameter("@ann", CStr(cmb_annee.SelectedItem))) .Add(New SqlParameter("@mat", SqlDbType.Int)) .Add(New SqlParameter("@n", SqlDbType.NVarChar, 70)) .Add(New SqlParameter("@p", SqlDbType.NVarChar, 70)) End With cmd.Parameters("@pro").Direction = ParameterDirection.Input cmd.Parameters("@ann").Direction = ParameterDirection.Input cmd.Parameters("@mat").Direction = ParameterDirection.Output cmd.Parameters("@n").Direction = ParameterDirection.Output cmd.Parameters("@p").Direction = ParameterDirection.Output cmd.ExecuteNonQuery() Dim dr As SqlDataReader = cmd.ExecuteReader() Dim lvi As New ListViewItem While cmd.ExecuteReader.HasRows lvi = New ListViewItem(New String() {cmd.Parameters("@mat").Value.ToString, cmd.Parameters("@n").Value.ToString, cmd.Parameters("@p").Value.ToString}) liste.Items.Add(lvi) End While dr.Close()
merci
Partager