Results 1 to 4 of 4

Thread: [RESOLVED] parameter value does not show

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2004
    Location
    in the heart of the Mediterranean
    Posts
    1,143

    Resolved [RESOLVED] parameter value does not show

    Hi this Procedure works fine and so does the stored procedure, at least it compiles successfully , but still the balance is Null and does not display in the txtLABookBalance.Text.

    can anyone pls spot the reason???


    Code:
    Private Sub Get_LABook_Balance()
    
            Dim queryLABookBalance As String = "Report_ONE_LABKBalance"
            Dim cmd As New SqlClient.SqlCommand(queryLABookBalance, MyConn)
            Try
                If cboLABook.SelectedIndex = -1 Then
                    MessageBox.Show("No L/A Book have been posted for selected L/A")
    
                Else
                    cmd.CommandType = CommandType.StoredProcedure
                    cmd.Parameters.AddWithValue("@bookFID", cboLABook.SelectedValue)
                    cmd.Parameters.AddWithValue("@LANo", cboLASuppReport.SelectedValue)
                    cmd.Parameters.Add("@balance", SqlDbType.Int)
                    cmd.Parameters("@balance").Direction = ParameterDirection.Output
                    cmd.Parameters.Add("@ReturnText", SqlDbType.NVarChar, (80))
                    cmd.Parameters("@ReturnText").Direction = ParameterDirection.Output
    
                    MyConn.Open()
    
                    If Not CStr(cmd.Parameters("@ReturnText").Value) = String.Empty Then
                        'LA has no book orders                    
                        MessageBox.Show(CStr(cmd.Parameters("@ReturnText").Value).ToString)
                    Else
                        txtLABookBalance.Text= (CStr(cmd.Parameters("@balance").Value))                   
    
                    End If  'displaying message if LA has no orders yet
                    cmd.Parameters.Clear()
                    MyConn.Close()
                End If
            Catch ex As Exception
                MsgBox(ex.Message)
                MyConn.Close()
            End Try
    
        End Sub
    Code:
    @balance int OUTPUT,
    @ReturnText nvarchar(80) OUTPUT,
    @LANo nvarchar(15),
    @bookFID int
    
    AS
    BEGIN
    
    DECLARE @count  INT
    DECLARE @intErrorCode int
    
    
    SET @count = (SELECT balance from tb_LAbook where (LANo=@LANo AND bookFID=@bookFID))
    
    IF @count > 0
       BEGIN
         SELECT @balance=balance from tb_LAbook  WHERE  (LANo=@LANo AND bookFID=@bookFID)
    
       END  
    ELSE
       BEGIN
        SET  @ReturnText='@LANo ' + (CONVERT(NVARCHAR(15),@LANo))+ 'has no Orders for the selected Book. '
          RETURN
       END  
    END
    ------------------------------------------------------------------------
    If an answer to your question has been helpful, then please, Rate it!

  2. #2
    Frenzied Member
    Join Date
    Jan 2006
    Posts
    1,875

    Re: parameter value does not show

    you simply missed

    Code:
    cmd.ExecuteNonQuery()
    statement
    after MyConn.Open()
    __________________
    Rate the posts that helped you

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2004
    Location
    in the heart of the Mediterranean
    Posts
    1,143

    Re: parameter value does not show

    Hi Rit,

    WAW . Thanks. Good to see you back.
    ------------------------------------------------------------------------
    If an answer to your question has been helpful, then please, Rate it!

  4. #4
    Frenzied Member
    Join Date
    Jan 2006
    Posts
    1,875

    Re: parameter value does not show

    Quote Originally Posted by angelica
    Hi Rit,

    WAW . Thanks. Good to see you back.
    seems problem is solved

    nowaday too much work at my end
    __________________
    Rate the posts that helped you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width