Private Sub cmdLogin_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles cmdLogin.Click BEGIN Метка A ?Declare connection string and assign ?a value to it. Dim str1 As String = «Data Source=CABSONY1;» & _ «Initial Catalog=SqlMagMemberApp;» & _ «Integrated Security=SSPI» ?Instantiate a connection. Dim cnn1 As SqlClient.SqlConnection = _ New SqlClient.SqlConnection(str1) cnn1.Open() END Метка A BEGIN Метка B ?Declare command to validate MemberID and ?password. Dim cmd1 As SqlClient.SqlCommand = cnn1.CreateCommand cmd1.CommandType = CommandType.StoredProcedure cmd1.CommandText = «IsValidMember» ?Excluded code for handling command parameters: . . . ?Execute the command. cmd1.ExecuteNonQuery() END Метка B BEGIN Метка C ?Accept the return value: ?1 if valid ?0 otherwise Dim count As Byte = _ CByte(cmd1.Parameters(«@OK»).Value) If count = 1 Then Session(«MemberID») = txtMemberID.Text Session(«Password») = txtPassword.Text Session(«LoggedIn») = True Response.Redirect(«Default.aspx») Else Session(«LoggedIn») = False Response.Redirect(«NotLoggedIn.htm») End If END Метка C End Sub