Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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 = txtPwdDatabase name = Database
Table name = User
Here the codes:Imports System.Data
Imports System.Data.SqlClient
Partial Class LoginPage
Inherits System.Web.UI.PageProtected 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.

![]() |
![]() |
![]() |

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