Denne metode skal returnere en string, men der er ingen output?
Hej med jer...Min metode underneden som skal returnere en String, returnere ikke noget.
Jeg binder outputtet til en datalist kontrol.
Hvad er der galt?
kode:
--------------------------------------------------------
Public Function GetNewsTopics() As String
Dim oConnection As SqlConnection
Dim oCommand As SqlCommand
Dim oDataReader As SqlDataReader
Dim IsConnection As Boolean = True
While IsConnection
Try
oConnection = New SqlConnection(DB("TeleLet"))
oConnection.Open()
oCommand = New SqlCommand
With oCommand
.CommandText = "spGetNewsTopics"
.CommandType = CommandType.StoredProcedure
.Connection = oConnection
oDataReader = .ExecuteReader(CommandBehavior.CloseConnection)
End With
Dim output As String
While oDataReader.Read
output = (oDataReader.GetInt32(0) & ", " & oDataReader.GetString(1))
End While
Return output
Catch ex As Exception
LogErrorEvent(ex.Message)
Finally
oDataReader.Close()
End Try
End While
End Function
------------------------------------------------------
Mvh
DK