所以我有两个变量,即
Public statusId As String = String.Empty
Public orderDescription As String = String.Empty
我想在一个函数中设置它们的值,这就是我试过的
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
但是当我在函数之后打印出它们的值时它们仍然是空白的,所以我想知道我应该使用什么类型的功能,即子功能,......这样做?
像这样打电话
'# Retrieve Order Information
GetOrderDetails(statusId, orderDescription, orderID, userID)
答案 0 :(得分:0)
像这样定义你的功能
Public Function GetOrderDetails(ByRef statusId As String, ByRef orderDescription As String, ByVal orderID As String, ByVal userID As String) As String