MS Access data from Stored Procedure

Posted on 2012-09-19
Last Modified: 2012-09-24
I have a button that on click I want to execute a stored procedure and then set a variable )strEnc) to the returned value of the column name (encContactID)

Been in .Net for a while and sp can't see where I set the variable from this

    Set cmd.ActiveConnection = Conn
    cmd.CommandType = adCmdStoredProc
    cmd.CommandText = "[usp_EncryptClientContactID]"
    cmd.Parameters("@ContactID") = Me.[Contact ID]
Question by:lrbrister
    LVL 29

    Expert Comment

    by:Paul Jackson
    How are you returning the value in the stored procedure ? Output parameter, return value?

    Author Comment

    Just returning a value for additional question
    LVL 29

    Expert Comment

    by:Paul Jackson
    PLease post your Stored Procedure, I know you are returning a value I need to understand what method you are using to return the value if you are at all

    Accepted Solution

    Found my own answer
            Dim strMailTo As String
            Dim cid As String
            Dim cmd As New ADODB.Command
            Dim retSet As ADODB.Recordset
            Set cmd.ActiveConnection = Conn
            cmd.CommandType = adCmdStoredProc
            cmd.CommandText = "[usp_EncryptString]"
            cmd.Parameters("@string") = "id:" & Me.[Contact ID] & "|type:ClientContact"
            Set retSet = cmd.Execute
            If Not retSet.EOF Then
                cid = retSet![encContactID]
            End If

    Author Closing Comment

    Found my own answer

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Lync meeting or Lync conferencing is what many organizations would like to deploy to allow them save money. But companies are now giving up for various reasons, one of which is that they cannot join external meetings (non-federated company meetings)…
    User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
    In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
    The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

    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