Home » 2012 » October

Archive for October, 2012

Update counter in lookup table

Code behind Imports System.Web.UI Imports System.Data.Sql Imports System.Data.SqlClient Partial Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load ‘acquire the ad id Dim adLookupCS As String = ConfigurationManager.ConnectionStrings + (“My_ConnectionString1”).ToString Dim adLookupConn As New SqlConnection(adLookupCS) Dim adLookupCmd As New SqlCommand(“SELECT * FROM recordLookup;”, adLookupConn) Dim adLookupRdr As SqlDataReader […]

Website Uptime Monitor

Default Page <markup code> < %@ Page Title=”Home Page” Language=”VB” MasterPageFile=”~/Site.Master” AutoEventWireup=”false” CodeFile=”Default.aspx.vb” Inherits=”_Default” %> <asp:content ID=”HeaderContent” runat=”server” ContentPlaceHolderID=”HeadContent”> </asp:content> <asp:content ID=”BodyContent” runat=”server” ContentPlaceHolderID=”MainContent”> <!–page title–> <h2> Current website status! <div style=”min-height: 20px;”> <!– iframe loading content –> <iframe src=”real_time_site_monitor.aspx” frameborder=”0″ style=”width: 900px; height: 400px;”></iframe> </asp:content> </asp:content> <code behind> Imports System.Net Imports System.Net.Sockets Partial Class […]

Record Count Using Stored Procedure

Imports System.Data.SqlClient Partial Class mb_app_promo Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) _ Handles Me.Load G1.Text = “500” Dim connString As String connString = ConfigurationManager.ConnectionStrings(“myConnString”).ToString Dim conn As New SqlConnection(connString) Try conn.Open() Dim cmd As New SqlCommand(“myStoredProcedure”, conn) Dim count As Integer = CInt(cmd.ExecuteScalar()) If count >= 500 Then Goal1.Text […]