Call stored procedure from

Posted on 2014-07-10
Last Modified: 2014-07-14
I have an page (written in vb) and am trying to determine how to call a sql server stored procedure

that has 1 input parameter

@EmailProfileName VARCHAR(1000)

The stored procedure does not return any data but I would like to capture the execution status

Not sure how to format the call

sql connection is in a variable called strConn
Question by:johnnyg123
    1 Comment
    LVL 32

    Accepted Solution

    try something like this:

    Dim query As String = "spCreateBirthdayMailHouseFileASPForm"
    Dim ID As Integer
    Dim strConn As String = "<fill out conn string details here>"
    Using conn As New SqlConnection(strConn)
      Using cmd As New SqlCommand(query, conn)
        cmd.CommandType = CommandType.StoredProcedure
        cmd.Parameters.AddWithValue("@EmailProfileName", Category.Text)
        cmd.Parameters.Add("@resultStatus", SqlDbType.Int, 0, "CategoryID")
        cmd.Parameters("@resultStatus").Direction = ParameterDirection.Output
        ID = cmd.Parameters("@resultStatus").Value
      End Using
    End Using

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    I have developed many web applications with asp & and to add and use a dropdownlist was always a very simple task, but with the new, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
    ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    This video discusses moving either the default database or any database to a new volume.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now