|
-
Sep 9th, 2008, 01:07 PM
#1
Thread Starter
Frenzied Member
[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! 
-
Sep 9th, 2008, 01:12 PM
#2
Re: parameter value does not show
you simply missed
Code:
cmd.ExecuteNonQuery()
statement
after MyConn.Open()
__________________
Rate the posts that helped you 
-
Sep 9th, 2008, 01:44 PM
#3
Thread Starter
Frenzied Member
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! 
-
Sep 9th, 2008, 01:48 PM
#4
Re: parameter value does not show
 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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|