Computing.Net > Forums > Programming > vb login

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

vb login

Reply to Message Icon

Name: rheyna
Date: June 25, 2009 at 00:12:49 Pacific
OS: Windows XP
CPU/Ram: cpu
Subcategory: General
Comment:

hi there. how to do login page.
which is in vb codes by using microsoft sql server management studio? I have error when i tried the correct username & password.

username textbox name = txtUser
password textbox name = txtPwd

Database name = Database
Table name = User


Here the codes:

Imports System.Data
Imports System.Data.SqlClient
Partial Class LoginPage
Inherits System.Web.UI.Page

Protected Sub btnLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLogin.Click


Dim username As String, pass As String
username = txtUser.Text
pass = txtPwd.Text
Dim count As Integer = 0
Dim mySQL As String

mySQL = "SELECT * FROM User WHERE Username = '" & username & "'AND Password ='" & pass & "'"

Dim conn As New SqlConnection("data source=ITCU-42\SQLEXPRESS; initial catalog=Database; integrated security = true")
Dim cmd As New SqlCommand(mySQL, conn)
conn.Open()



mySQL = "Insert into User(Username) VALUES('" & count + 1 & "') where Username = '" & username & "'"
mySQL = "UPDATE User set Username = '" & count = +1 & "' where Username = '" & username & "'"


mySQL = "Insert into User(Password) VALUES('" & count + 1 & "') where Password = '" & pass & "'"
mySQL = "UPDATE User set Password = '" & count = +1 & "' where Password = '" & pass & "'"

username = "SELECT * FROM User(Username)"
pass = "SELECT * FROM User(Password)"

If txtUser.Text = username And txtPwd.Text = pass Then

lblMsg.Text = "You have Login Successfully!"


txtUser.Focus()
Else


lblMsg.Text = "Incorrect Username and Password!"
txtUser.Focus()



conn.Close()


End If

End Sub
End Class


Thanks in advance.



Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: vb login

Vb login form www.computing.net/answers/programming/vb-login-form/11840.html

run dos command in vb www.computing.net/answers/programming/run-dos-command-in-vb/121.html

Problem with VB coding www.computing.net/answers/programming/problem-with-vb-coding/6092.html