How to Execute a Stored Procedure on VB.NET
24,924
You need the following code for executing a stored procedure
Imports System.Data.SqlClient
Dim conn as New SqlConnection(YourConnectionString)
Dim cmd as SqlCommand = conn.createcommand
conn.open()
cmd.CommandType = CommandType.StoreProcedure
cmd.Parameters.Add(New SqlParameter("@OE", YourValue)
cmd.CommandText = DeletetblOfficeEquipmentProfileRecord
cmd.ExecuteNonQuery()
conn.close()
Author by
ivandinglasan
Updated on May 13, 2020Comments
-
ivandinglasan about 4 years
CREATE PROCEDURE DeletetblOfficeEquipmentProfileRecord @OE_ID varchar(11) AS BEGIN DELETE FROM [EOEMS].[dbo].[tblOfficeEquipmentProfile] WHERE [OE_ID]=@OE_ID END RETURN GO
Above is my sql stored procedure how will I execute in in vb.net 2003
this SP is for delete a records based on an OE_ID chosen on the textbox