Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Function NewsArchive(ByVal iConnectionName As String, ByVal iTable As String, ByVal iRepeater As Repeater,
- ByVal iPageSizeCount As Integer,
- ByVal iOrderBy As String, ByVal iOrderAscending As Boolean,
- ByVal iCurrenPage As Integer) As String
- SetActionResult = "waiting_NewsArchive"
- Dim tempTrailer As String = ""
- Dim TempSQLCommand As String = ""
- Dim tempOrderType As String = IIf(iOrderAscending, "ASC", "DESC")
- TempSQLCommand = "SELECT * FROM " & iTable & " WHERE VISIBLE=1 ORDER BY " & Trim(iOrderBy) & " " & tempOrderType
- Dim Conn As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("DataBaseConnection").ConnectionString)
- Try
- Conn.Open()
- Dim DA As SqlDataAdapter = New SqlDataAdapter(TempSQLCommand, Conn)
- Dim DT As DataTable = New DataTable()
- DA.Fill(DT)
- Dim objPds As PagedDataSource = New PagedDataSource()
- objPds.DataSource = DT.DefaultView
- objPds.AllowPaging = True
- objPds.PageSize = iPageSizeCount
- Dim curpage As Integer = iCurrenPage
- objPds.CurrentPageIndex = iCurrenPage - 1
- SetNewsArchivePageCount = objPds.PageCount
- iRepeater.DataSource = objPds
- iRepeater.DataBind()
- Conn.Close()
- SetActionResult = "done_NewsArchive"
- Catch exp As Exception
- SetErrorMessage = exp.Message
- SetActionResult = "error_NewsArchive"
- Conn.Close()
- End Try
- Return tempTrailer
- End Function
Advertisement
Add Comment
Please, Sign In to add comment