Bonjour,
J'ai créé une procedure stocké sous sql serveur qui doit m'afficher une liste de client :
En m'aidant de ce tuto : http://dotnet.developpez.com/articles/ado1/vbnet/ j'ai appelé ma procedure comme ceci
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 ALTER proc verifimpayé2 (@mois datetime) as declare cursimpayé cursor for select nomclient, prenomclient from dbo.client, dbo.etatlieu where client.idclient = etatlieu.idclient AND dbo.etatlieu.idclient not in (select idclient from paiement where mois = @mois) and @mois > = date_debut_EL and date_fin_EL is NULL; declare @nomclient char(10), @prenomclient char(10) begin open cursimpayé fetch next from cursimpayé into @nomclient,@prenomclient while (@@fetch_status=0) begin print 'Impayé : ' + @nomclient + @prenomclient fetch next from cursimpayé into @nomclient,@prenomclient end close cursimpayé deallocate cursimpayé end
La procédure stocké est bien appelé(j'ai ajouté un insert dedans pour tester) mais je n'arrive pas a afficher ma liste de client.
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 Dim strConnexion As String = "Persist Security Info=False;Integrated Security=SSPI;database=bd_immobilier;server=PC-DE-UTILISATE" Dim strProcedureStockee As String = "verifimpayé2" Dim oConnection As New SqlConnection(strConnexion) Dim oCommand As New SqlCommand(strProcedureStockee,oConnection) oCommand.CommandType = CommandType.StoredProcedure Dim oParam As SqlParameter = oCommand.Parameters.Add("@mois", SqlDbType.DateTime, 8, "mois") oParam.Value = "01/02/2009" oConnection.Open() Dim oReader As SqlDataReader = oCommand.ExecuteReader() While oReader.Read() ListView1.Items.Add(oReader.GetString(0)) ListView1.Items(ListView1.Items.Count1).SubItems.Add(oReader.GetString(0)) .... End While oReader.Close() oConnection.Close()
J'ai essayé avec un parametre de sortie mais ce la ne fonctionne pas.
Merci d'avance
Partager