Er du sikker på at din CountReplys virker? Er det ikke den der fejler? Hvad returnere repliesObject.CountReplys(postID)? En streng? Eller en Integer - hvis dette er tilfældet vil det være en godt ide at sige repliesObject.CountReplys(postID).ToString
Public Function CountReplys(ByVal postID As String) As String Dim con As New SqlConnection(connectionString)
Dim strSQL As String = "SELECT COUNT(*) AS Antal FROM tbl_EmpForums_Replies WHERE PostID=" & postID
Dim cmd As New SqlCommand("strSQL", con)
Dim Result As Integer = 0
Try If con.State <> ConnectionState.Open Then con.Open() End If
Result = CType(cmd.ExecuteScalar(), Integer) Catch 'Throw New Exception() cmd.Cancel() con.Close() Finally If con.State <> ConnectionState.Closed Then con.Close() con.Dispose() End If End Try
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.