#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Posts
    2
    Rep Power
    0

    Whats the difference on .ReturnValue and .Output?


    I use a Firebird 2.5 an call a stored procedures.

    The called server stored procedure
    CREATE OR ALTER PROCEDURE P_BLOCK_KONTROLLE (
    aufruftitel varchar_255,
    testext_in varchar_255)
    returns (
    blockid id,
    istzeit zeitstempel,
    rueckgabetitel varchar_255,
    testext_aus varchar_255)
    as
    begin
    blockid = 10;
    istzeit = current_timestamp;
    rueckgabetitel = aufruftitel;
    testext_aus = testext_in;
    suspend;
    end


    The vb-code, that calls the procedure
    Sub AufrufStoredProcedure()

    Dim cn As New FbConnection(strDBConn)
    cn.Close()
    cn.Open()
    Dim cmd As New FbCommand("p_block_kontrolle", cn)
    cmd.CommandType = CommandType.StoredProcedure

    Dim fbParamI_1 As FbParameter = cmd.Parameters.AddWithValue("A", "Hello World")
    Dim fbParamI_2 As FbParameter = cmd.Parameters.AddWithValue("E", "Simple test text")

    Dim fbParamR_1 As FbParameter = cmd.Parameters.Add("B", FbDbType.Integer)
    Dim fbParamR_2 As FbParameter = cmd.Parameters.Add("C", FbDbType.TimeStamp)
    Dim fbParamR_3 As FbParameter = cmd.Parameters.Add("D", FbDbType.VarChar, 255)

    fbParamI_1.Direction = ParameterDirection.Input
    fbParamI_2.Direction = ParameterDirection.Input



    ' declaration with ReturnValue
    fbParamR_1.Direction = ParameterDirection.ReturnValue
    fbParamR_2.Direction = ParameterDirection.ReturnValue
    fbParamR_3.Direction = ParameterDirection.ReturnValue


    cmd.ExecuteNonQuery()
    Debug.Print("Version with ReturnValue")
    Debug.Print("Input-Parameter 1 = " + fbParamI_1.Value.ToString)
    Debug.Print("Return-Parameter 1 = " + fbParamR_1.Value.ToString)
    Debug.Print("Return-Parameter 2 = " + fbParamR_2.Value.ToString)
    Debug.Print("Return-Parameter 3 = " + fbParamR_3.Value)


    ' declaration with Output
    fbParamR_1.Direction = ParameterDirection.Output
    fbParamR_2.Direction = ParameterDirection.Output
    fbParamR_3.Direction = ParameterDirection.Output


    cmd.ExecuteNonQuery()
    Debug.Print("Version with Output")
    Debug.Print("InputOutput-Parameter 1 = " + fbParamI_1.Value.ToString)
    Debug.Print("Return-Parameter 1 = " + fbParamR_1.Value.ToString)
    Debug.Print("Return-Parameter 2 = " + fbParamR_2.Value.ToString)
    Debug.Print("Return-Parameter 3 = " + fbParamR_3.Value)

    cn.Close()
    cn.Dispose()
    End Sub

    With both declaration i get the requested result.
    I do not see any difference.
    Whats the reason for this two options?
    Thanks for a short explanation.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2006
    Location
    Carlsbad, CA
    Posts
    2,055
    Rep Power
    383
    I am just guessing (in an educated way) but I think this is a question for a VB forum.
    There is just one set of out parameters as far as Firebird is concerned.
    How VB treats/names them I do not know.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Posts
    2
    Rep Power
    0
    Originally Posted by clivew
    I am just guessing (in an educated way) but I think this is a question for a VB forum.
    There is just one set of out parameters as far as Firebird is concerned.
    How VB treats/names them I do not know.
    The reason to post this question on a Firebird Forum is, that the declarations made in the VB code all base on the
    FirebirdSql.Data.FirebirdClient.dll (FBCommand, FBParamters and so on).
    So the cmd-Variable is instance of FBCommand and fbparam is a instance/child of cmd.

    fbparam has two characteristics (ReturnValue; Output).
    Both are working fine, both are directly depending on the .DLL-Interface from Firebird. I just do not see a difference between. If they are equal I'm happy.

IMN logo majestic logo threadwatch logo seochat tools logo