So I have 2 variables I.e.
Public statusId As String = String.Empty
Public orderDescription As String = String.Empty
And I want to set their values within a function, this is what I tried
Public Function GetOrderDetails(ByVal statusId As String, ByVal orderDescription As String, ByVal orderID As String, ByVal userID As String) As String
Dim conn As New DBConnection()
Dim sql_UserAttempts As SqlCommand = conn.SetStoredProcedure("spOrderDetailsByUserId")
DBConnection.AddNewParameter(sql_UserAttempts, "@order_ID", ParameterDirection.Input, SqlDbType.Int, orderID)
DBConnection.AddNewParameter(sql_UserAttempts, "@user_ID", ParameterDirection.Input, SqlDbType.Int, userID)
Try
conn.Open()
Dim reader_attempts As SqlDataReader = sql_UserAttempts.ExecuteReader()
If reader_attempts.HasRows Then
While reader_attempts.Read()
statusId = reader_attempts("statusId").ToString()
orderDescription = reader_attempts("ud_orderDescription").ToString()
End While
End If
Catch ex As Exception
M1Utils.ErrorHandler(ex)
Finally
conn.Close()
End Try
Return statusId
End Function
But when I print out their values after the function they still blank so I was wondering what type of functinon i should use i.e. sub function,.. to do this ?
Called like this
'# Retrieve Order Information
GetOrderDetails(statusId, orderDescription, orderID, userID)
Define your function like this