1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
Dim oSqlConnexion As New System.Data.SqlClient.SqlConnection("Ma chaine de connection") 'Ma chaine de connection
Dim oSqlCommand As New System.Data.SqlClient.SqlCommand("Nom_de_ma_procedure_stockee", oSqlConnexion)
oSqlCommand.CommandType = Data.CommandType.StoredProcedure
'-------Déclaration des paramètres-----------------------
Dim oParam1 As System.Data.SqlClient.SqlParameter = oSqlCommand.Parameters.Add("@Param1", Data.SqlDbType.Int)
'Pense à modifier le type Data.SqlDbType selon le paramètre
oParam1.Value = "Ma valeur pour le Param1"
'Remplacer @Param1 par ton paramètre dans ta procédure stockées
'créé autant de paramètre comme ci-dessu qu'il y a de paramètres dans ta procédure stockées
'--------------------------------------------------------
Dim nIdEnregistrement As Int16 = 0 'Id retourné par la requête
oSqlConnexion.Open()
nIdEnregistrement = oSqlCommand.ExecuteScalar()
oSqlConnexion.Close() |
Partager