Dim objConn As SqlConnection
Dim objCmd As SqlCommand
Dim strSQL As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
If Session("UserAuthentication") = "" Then
Response.Redirect("Login1.aspx")
End If
End Sub
Sub BindData()
Dim strConnString As String
strConnString = "Server=localhost\SQLExpress;Database=Myweb;Trusted_Connection=True;"
objConn = New SqlConnection(strConnString)
objConn.Open()
Dim FgPass As String
strSQL = "SELECT Password FROM Username WHERE Username = '" & txtUsername.Text & "' "
objCmd = New SqlCommand(strSQL, objConn)
FgPass = objCmd.ExecuteScalar()
If FgPass > 0 Then
lblShow.Text = ""
Else
End If
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
BindData()
End Sub
Tag : .NET, VBScript, Web (ASP.NET), VB.NET, VS 2005 (.NET 2.x)