I know this is not a proper place to post my thread.Am sorry.
I have this code and i am not to get the retun value from the proc. I did a breakpoint on the function and the invoice variable is empty.
What is worng with this code? Thanks
ALTER PROCEDURE [dbo].[spGetName]
@prodID as nvarchar(50)
AS
BEGIN
Declare @invoiceID as Nvarchar(50)
Set @invoiceID = Replace(replace(Replace(replace(CONVERT(Nvarchar(50),Getdate(),120),'-',''),' ' ,''),':',''),'.','')
Insert into dbo.Invoice(invoiceID,ProdID) values(@invoiceID,@prodID)
Return @invoiceID
END
Shared Function Invoice(ByVal prodID As String) As String
Dim Invoice As String
Using sqlcmd As New SqlCommand("spGetName", getConn)
sqlcmd.CommandType = Data.CommandType.StoredProcedure
sqlcmd.Parameters.Add(New SqlParameter("@prodID", SqlDbType.NVarChar, 50)).Value = prodID
Invoice = sqlcmd.Parameters.Add(New SqlParameter("@Return_Value", SqlDbType.NVarChar, 50)).Direction = ParameterDirection.ReturnValue
sqlcmd.ExecuteNonQuery()
End Using
getConn.Close()
Return Invoice
End Function