Login page in vb.net

Posted by Satyapriyanayak under VB.NET category on | Points: 40 | Views : 1078
Imports System.Data
Imports System.Data.OleDb
Public Class Form1
Dim ConnectionString As String = System.Configuration.ConfigurationSettings.AppSettings("dsn")
Dim com As OleDbCommand
Dim str As String

Dim obj As Object = Nothing

Private Sub btn_login_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_login.Click
Dim con As New OleDbConnection(ConnectionString)
str = "select count(*) from login where UserName=@UserName and Password =@Password"
com = New OleDbCommand(str, con)
com.CommandType = CommandType.Text
com.Parameters.AddWithValue("@UserName", TextBox_user_name.Text)
com.Parameters.AddWithValue("@Password", TextBox_password.Text)
obj = com.ExecuteScalar()
If CInt(obj) <> 0 Then
lb1.Text = "WELLCOME :: " + TextBox_user_name.Text
lb1.Text = "invalid user name and password"
End If

End Sub
End Class

Comments or Responses

Login to post response