Login form help

Hi Folks,

Can someone please help me with the code below

I keep getting invalid crendials, even though I enter the right username and password, can anyone please help me fault find the problem?


<%@ Page Language="VB" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>

<script runat="server">
    Protected Sub Button1_Click(ByVal sender As Object, _
      ByVal e As System.EventArgs)

           ' Define database connection
	Dim connStr As String = ConfigurationManager.ConnectionStrings("SqlDataSource1").ConnectionString
    Dim conn As New SqlConnection(connStr)
       Dim cmd As SqlCommand
       Dim cmdString As String = "SELECT Username, Password FROM LU.users WHERE" & _
          " ((Username = @Username) AND (Password = @Password))"
       cmd = New SqlCommand(cmdString, conn)
       cmd.Parameters.Add("@Username", SqlDbType.VarChar, 50)
       cmd.Parameters("@Username").Value = TextBox1.Text
       cmd.Parameters.Add("@Password", SqlDbType.VarChar, 50)
       cmd.Parameters("@Password").Value = TextBox1.Text
       Dim myReader As SqlDataReader
       myReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)
       If myReader.Read() Then
          Response.Write("Invalid credentials")
       End If
   End Sub

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Login Page</title>
<body> <form id="form1" runat="server">
        Username<br />
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br />
        <br />
        Password<br />
        <asp:TextBox ID="TextBox2" runat="server" 
         TextMode="Password"></asp:TextBox><br />
        <br />
        <asp:Button ID="Button1" OnClick="Button1_Click" runat="server" 
         Text="Submit" />

cmd.Parameters(“@Password”).Value = TextBox1.Text

should be

cmd.Parameters(“@Password”).Value = TextBox2.Text