Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

my code does not seem to work...it only redirects the page if the username and password is empty...

 

sub login_Click(s as Object, e As EventArgs)
       dim conPubs As SqlConnection
       dim cmdSelect as SqlCommand
       dim name as string
       dim name2 as string
       dim pass as string
       dim pass2 as string
       dim passing as SqlDataReader
       dim str as String
   if IsValid then
       conPubs=New SqlConnection("Server=localhost;User Id=sa;Password=edna;database=ES")
       str = "Select Password From Passwd Where Name=@Name"
       cmdSelect= New SqlCommand(str, conPubs)
       cmdSelect.Parameters.Add("@Name", TextBox1.Text )
       'cmdSelect.Parameters.Add("@Password", txtPass.Text)

       conPubs.Open()
       'name = txtPass.Text
       'name2 = cmdSelect.ExecuteScalar()
       'TextBox1.Text = name
       'TextBox2.Text = name2
       if txtPass.Text = cmdSelect.ExecuteScalar() then
           conPubs.Close()
           FormsAuthentication.RedirectFromLoginPage _
                   (TextBox1.Text, CheckBox1.Checked)
       else
           TextBox1.Text = ""
           conPubs.Close
           'Server.Transfer("login.aspx")
       end if
   end if
end sub

##EYPS##

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...