asked on
Shared Function lastpost(ByVal title As String) As Results
Dim con As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Documents and Settings\perkinj\My Documents\Visual Studio 2010\WebSites\runningprofiles\forums\forum.mdb;")
Dim cmd As New OleDbCommand
cmd.Connection = con
cmd.Parameters.AddWithValue("@title", title)
Try
con.Open()
Dim Res As Results
cmd.CommandText = "Select Count(*) From forum where Forum =@title and numrep <> 0 "
Res.Result2 = cmd.ExecuteScalar()
cmd.CommandText = "Select title + '|' + LastPoster +'|' + Format(lasttime, 'dd/mm/yyyy hh:mm:ss') from forum where Forum =@title order by Format(lasttime, 'dd/mm/yyyy hh:mm:ss') ASC"
Res.Result3 = cmd.ExecuteScalar()
Return (Res)
Catch ex As Exception
Throw ex
Finally
con.Close()
End Try
End Function
cmd.CommandText = "Select TOP(1) title + '|' + LastPoster +'|' + Format(lasttime, 'dd/mm/yyyy hh:mm:ss') from forum where Forum =@title order by CONVERT(Datetime, lasttime) DESC"
ASKER
Shared Function noposts(ByVal forumname As String) As Results
Dim con As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Documents and Settings\perkinj\My Documents\Visual Studio 2010\WebSites\runningprofiles\forums\forum.mdb;")
Dim cmd As New OleDbCommand
cmd.Connection = con
cmd.Parameters.AddWithValue("@forumname", forumname)
Try
con.Open()
cmd.CommandText = "Select Count(*) From forum where Forum =@forumname"
Dim Res As Results
Res.Result1 = cmd.ExecuteScalar()
cmd.CommandText = "Select Count(*) From forum where Forum =@forumname and numrep = 0 "
Res.Result2 = cmd.ExecuteScalar()
cmd.CommandText = "Select TOP 1 title + '|' + LastPoster +'|' + Format(lasttime, 'dd/mm/yyyy hh:mm:ss') from forum where Forum =@forumname AND numrep = 0 order by CONVERT(Datetime, lasttime) DESC"
Res.Result3 = cmd.ExecuteScalar()
Return (Res)
Catch ex As Exception
Throw ex
Finally
con.Close()
End Try
End Function
Visual Basic .NET (VB.NET) is an object-oriented programming language implemented on the .NET framework, but also supported on other platforms such as Mono and Silverlight. Microsoft launched VB.NET as the successor to the Visual Basic language. Though it is similar in syntax to Visual Basic pre-2002, it is not the same technology,
TRUSTED BY