Imports System.Data.SqlClient
Public Class index
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents lbCount As System.Web.UI.WebControls.Label
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Public strConn As String = "data source=xx.xx.xxx.xxx; User ID=xxxxxx; Password=xxxxxx;
Persist Security Info=True;packet size=4096"
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
DisplayCustomerCount()
End Sub
Sub DisplayCustomerCount()
Dim cmd As New SqlCommand("Select Count(UID) From Customers", New SqlConnection(strConn))
cmd.Connection.Open()
lbCount.Text = cmd.ExecuteScalar()
cmd.Connection.Close()
End Sub
End Class
|