Imports System.Data

Partial Class viewArchives
    Inherits System.Web.UI.UserControl

    Protected Sub grdFill()
        Dim db As New FirstClass()
        Dim dt As New DataTable()

        dt = db.dbOut("SELECT TOP 100 PERCENT tblNews.NewsID AS nwsID, tblNews.NewsTitle AS nwsTitle, NewsGroups.NewgGroupDescription AS nwsGroup, " & vbCr & vbLf & " Users.Name + N' ' + Users.Sname AS Expr1, tblNews.DateOfAdding AS nwsDtadd, tblNews.NewsPic, tblNews.newsBody, " & vbCr & vbLf & " SUBSTRING(tblNews.newsBody, 1, 700) AS NewsPart, tblNews.ArchivedDate FROM tblNews INNER JOIN Users ON tblNews.UserName = Users.UserName INNER JOIN" & vbCr & vbLf & " NewsGroups ON tblNews.NewsGroupID = NewsGroups.NewsGroupID WHERE (tblNews.ArchivedBit = 1) AND (tblNews.ArchivedDate = N'" & Request.QueryString("ArchiveID").ToString() & "') ORDER BY tblNews.NewsID DESC")

        GridView1.DataSource = dt
        GridView1.DataBind()
        Label6.Text = dt.Rows(0)(8).ToString()
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        grdFill()
    End Sub

    Protected Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridView1.PageIndexChanging
        GridView1.PageIndex = e.NewPageIndex
        grdFill()
    End Sub
End Class
