Finding the sum of all the value of a column.

Select  Sum(cast (m.FileSize as BigInt))
from Documents m

Documents->table name
FileSize->Column name

Setting the value dynamically

 ASPX
--------------------------------

<table width="100%" style="background-color:#336699;">
 <tr>
        <td style="background-color: #4791c5;width:100%;padding-right:50px"  colspan="3" align="right">
            <%--<asp:Label ID="lblCompanyName" runat="server" Font-Names="Verdana" Font-Size="X-Small"
                Visible="False" Font-Bold="false" ForeColor="White"></asp:Label>--%>
                <%= AccountandHelpLink %>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <a href="../../support.html"></a><a href="../../support.html"></a><a href="../../contact.html">
            </a><a href="../../contact.html"></a>
            <%= LogoffLink %>
        </td>
        <%--<td align="center" style="background-color: #4791c5;">
             <
        </td>--%>
    </tr>
</table>

C#
-------------------

LogoffLink = ControlChars.Cr & "<" & "a href='" & Request.ApplicationPath & "/Admin/Logoff.aspx'  ><FONT face='Verdana' font-family='Arial' size='1' color='ffffff'>" & "     SignOut<" & "/a>"


 AccountandHelpLink = "<" & "FONT face='Verdana' color='#ffffff' size='1'" & ">" & accLink & sUserId & "&username=" & sUserName & ">" & "<" & "FONT face='Verdana' color='#ffffff' size='1'" & ">" & "My Account" & "</FONT>" & "</a>&nbsp;&nbsp;" & "<span class='Accent'>|</span>" & "&nbsp;&nbsp;" & _
                    "<a href=" & sHelpfileLocation & " target='_new'>" & "<" & "FONT face='Verdana' color='#ffffff' size='1'" & ">" & "Help" & "</FONT>" & "</a>&nbsp;&nbsp;</FONT>&nbsp;"
             



Remember login using Cookies

CreateCookies()
--------------------------------------------------------------------------

Public Sub CreateCookies()
            'check if remember me checkbox is checked on login
            If (Me.RememberCheckbox.Checked) Then
                'Check if the browser support cookies
                If (Request.Browser.Cookies) Then
                    'Check if the cookie with name PBLOGIN exist on user's machine
                    If (Request.Cookies("PBLOGIN") Is Nothing) Then
                        'Create a cookie with expiry of 30 days
                        Dim uidPwd As HttpCookie = New HttpCookie("PBLOGIN")

                        uidPwd("UserName") = Me.email.Text
                        uidPwd("Pwd") = Me.password.Text
                        uidPwd.Expires = DateTime.Now.AddDays(5)
                        Response.Cookies.Add(uidPwd)

                        Dim x As String = Request.Cookies("PBLOGIN")("UserName").ToString()

                        Dim y As String = Request.Cookies("PBLOGIN")("Pwd").ToString()

                        'Response.Cookies("PBLOGIN").Expires = DateTime.Now.AddDays(30)
                        ''Write username to the cookie
                        'Response.Cookies("PBLOGIN").Item("UNAME") = Me.email.Text
                        ''Write password to the cookie
                        'Response.Cookies("PBLOGIN").Item("UPASS") = Me.password.Text
                        ''If the cookie already exist then wirte the user name and password on the cookie
                        'Else
                        '    Response.Cookies("PBLOGIN").Item("UNAME") = Me.email.Text
                        '    Response.Cookies("PBLOGIN").Item("UPASS") = Me.password.Text
                    End If
                End If
            End If
        End Sub

---------------------------------------------------------------

Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
            If Not IsPostBack() Then
                               CheckCookies()
            End If
        End Sub
-------------------------------------------------------------------------------


Public Sub CheckCookies()

            'Check if the browser support cookies
            If Request.Browser.Cookies Then
                'Check if the cookies with name PBLOGIN exist on user's machine
                If Request.Cookies("PBLOGIN") IsNot Nothing Then
                    'Pass the user name and password to the VerifyLogin method
                    Me.VerifyLogin(Request.Cookies("PBLOGIN")("UserName").ToString(), Request.Cookies("PBLOGIN")("Pwd").ToString())
                End If

            End If
        End Sub



------------------------------------------------------------------------------------------


Protected Sub VerifyLogin(ByVal UserName As String, ByVal Password As String)
            Try
                Me.email.Text = UserName
                Me.password.Text = Password

            Catch ex As System.Exception
                Response.Write(ex.Message)
            End Try
        End Sub


Page Events in VB

  Protected Sub page_preInit(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.PreInit
        Response.Write("Page preInit")
    End Sub

    Protected Sub page_init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Init
        Response.Write("Page init")
    End Sub


Protected Sub page_initComplete(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.InitComplete
        Response.Write("Page InitComplete")
    End Sub

   Protected Sub page_pagePreLoad(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.PreLoad
        Response.Write("Page PreLoad")
    End Sub

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

    End Sub

  Protected Sub page_pageLoadComplete(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.LoadComplete
        Response.Write("Page LoadComplete")
    End Sub


  Protected Sub page_pagePreRender(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.PreRender
        Response.Write("Page PreRender")
    End Sub

Protected Sub page_pagePreRenderComplete(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.PreRenderComplete
        Response.Write("Page PreRenderComplete")
    End Sub


Protected Sub page_pageSaveStateComplete(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.SaveStateComplete
        Response.Write("Page SaveStateComplete")
    End Sub






  
   
    Protected Sub page_pageDisposed(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Disposed
        Response.Write("Page Disposed")

    End Sub
    Protected Sub page_pageError(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Error
        Response.Write("Page Error")
    End Sub
 
 
    'Protected Sub page_pageUnload(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Unload
    '    Response.Write("Page Unload")
    'End Sub