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
| connectionstring = "Data Source=serveur\SQLEXPRESS;Initial Catalog=BD;Persist Security Info=True;User ID=test;Password=1"
Using connection As New SqlConnection(connectionstring)
connection.Open()
Dim commande As SqlCommand = connection.CreateCommand()
commande.CommandType = Data.CommandType.StoredProcedure
commande.CommandText = "RQEntreDescription"
commande.Parameters.AddWithValue("@noformat", noformat)
Dim curseur As SqlDataReader = commande.ExecuteReader()
'récupération de mon return value-----------------------------------
Dim test As SqlParameter = commande.Parameters.Add("@retour", SqlDbType.Int)
test.Direction = ParameterDirection.ReturnValue
ligne = commande.Parameters(2).Value
' et / ou ------------------------------------------------------------------
commande.Parameters.Add(New SqlParameter("@retour", SqlDbType.Int, 10))
commande.Parameters.Item("@retour").Direction = Data.ParameterDirection.ReturnValue
ligne = test.Value
'------------------------------------------------------------------
While (curseur.Read())
h2 = (curseur.GetInt32(1))
h3 = (curseur.GetInt32(2))
h4 = (curseur.GetInt32(3))
h5 = (curseur.GetInt32(4))
h1 = (curseur.GetInt32(5))
End While
curseur.Close()
End Using |
Partager