p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 2.0 Basics (http://p2p.wrox.com/forumdisplay.php?f=136)
-   -   How to check the password field for case-sensitive (http://p2p.wrox.com/showthread.php?t=37230)

zubash73 January 16th, 2006 06:18 AM

How to check the password field for case-sensitive
 
Hi friends...

    I am developing an ASP.NET web application with MS-ACCESS as
backend. For which i have
a login page where i have to validate user name and password. My doubt is
how to Check passowrd field
case sensitiveness with MS-ACCESS . Please send me solution..



Imar January 16th, 2006 01:24 PM

Quick question before I answer this one: Is there any reason why you're not using the new ASP.NET 2.0 Login controls that work with SQL Server Express and SQL Server?

Why develop your own login mechanism when you have all the tools for authentication available out of the box?

That said, take a look at StrComp. It's used compare strings. As an optional parameter, you can set options for how the compare is performed. 0 is a binary compare, which means it's case sensitive:

SELECT 1 FROM Members
WHERE StrComp(Members.Password, @password, 0) = 0

If the StrComp returns 0, it means Members.Password equals @password.

http://msdn.microsoft.com/library/de...fctstrcomp.asp

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.

Jackish January 31st, 2011 03:44 PM

Help With Vb 2008 and Ms Access 2010
 
Hi I have a problem where I am
designing a VB 2008 project with Ms Access 2010 as a Database Management program, I have created a login form and it works well but it is not case sensitive :O Here is my code:

Imports System.Data
Imports System.Data.OleDb

Public Class LogIn
Public accConnection As New OleDbConnection

Dim strConnectionString As String = "Provider=Microsoft.ACE.OLEDB.12.0;
Data Source = C:\Users\Jack\Documents\College
Work\Computing\A2\Coursework\Computer Work\Database\HFDB.accdb;Persist
Security Info=False;"

Private Sub Login_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim strConnectionString As String =
"Provider=Microsoft.ACE.OLEDB.12.0; Data Source =
C:\Users\Jack\Documents\College Work\Computing\A2\Coursework\Computer
Work\Database\HFDB.accdb;Persist Security Info=False;"

accConnection = New OleDbConnection(strConnectionString)
Try
accConnection.Open()
Catch oleDbExceptionErr As OleDbException
MessageBox.Show(oleDbExceptionErr.Message, "Access Error1")
Catch InvalidOperationExceptionErr As InvalidOperationException
MessageBox.Show(InvalidOperationExceptionErr.Messa ge, "Access
Error2")
End Try

If accConnection.State <> ConnectionState.Open Then
MessageBox.Show("Database Connection Failed!")
Exit Sub
End If
End Sub


Private Sub cmdLogin_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdLogin.Click
Dim cmdString1 As String = "SELECT Login_Username, Login_Password "
& "FROM Login "
Dim cmdString2 As String = "WHERE (Login_Username = @Username) AND
(Login_Password = " & "@Password) "

Dim cmdString As String = cmdString1 & cmdString2
Dim accCommand As New OleDbCommand
Dim accDataReader As OleDbDataReader
Dim SelForm As New MainPage


accCommand.Connection = accConnection
accCommand.CommandType = CommandType.Text
accCommand.CommandText = cmdString
accCommand.Parameters.Add("@Username", OleDbType.Char).Value =
txtUsername.Text
accCommand.Parameters.Add("@Password", OleDbType.Char).Value =
txtPassword.Text
accDataReader = accCommand.ExecuteReader

If accDataReader.HasRows = True Then
MessageBox.Show("Login Was Successful!")
SelForm.Show()
Me.Hide()
Else
MessageBox.Show("No Matching Username And Password Found")
End If

accDataReader.Dispose()
accDataReader = Nothing
accCommand.Dispose()
accCommand = Nothing
End Sub

Private Sub cmdCancel_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdCancel.Click
accConnection.Close()
accConnection.Dispose()
accConnection = Nothing
Me.Close()
End Sub

Can anybody help me by letting me know how I can make this case sensitive!
Any help is greatly appreciated :D
Thanks

Imar February 1st, 2011 03:37 AM

Hi Jack,

Take another look at my original post you replied to. It shows you how to alter your WHERE clause to make it case sensitive. I don't see that in your current WHERE clause and since Access by default queries in a case insensitive way, your password check is currently case insensitive.

Cheers,

Imar

Yuanne November 27th, 2016 02:47 AM

Case Sensitive VB using Ms Access
 
Please help my password is not case sensitive i dont know how to fix

here's my code:

Imports System.Data.OleDb
Public Class loginmain
Private conn As OleDbConnection
Private dapt As OleDbDataAdapter

Private Sub MyConnection()
conn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0 ;Data Source=" & Application.StartupPath & "\Data.accdb")
conn.Open()


End Sub
Private Sub loginmain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Panel5.Hide()
Watermark1.Focus()
Panel8.Hide()

End Sub
'form close
Private Sub MyForm_Closing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
If MessageBox.Show(" Are you sure you want to quit?", " ", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) <> DialogResult.Yes Then
e.Cancel = True
End If
End Sub
'PREVENT FLICKERING
Protected Overloads Overrides ReadOnly Property CreateParams() As CreateParams
Get
Dim cp As CreateParams = MyBase.CreateParams
cp.ExStyle = cp.ExStyle Or 33554432
Return cp
End Get
End Property
Private Sub PreVentFlicker()
With Me
.SetStyle(ControlStyles.OptimizedDoubleBuffer, True)
.SetStyle(ControlStyles.UserPaint, True)
.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
.UpdateStyles()
End With

End Sub

Private Sub BunifuTileButton1_Click(sender As Object, e As EventArgs) Handles loginbutton.Click
Dim pass1 As String

Dim tbl As New DataTable
MyConnection()
dapt = New OleDbDataAdapter("Select * from UserAccount Where StrComp Username='" & Watermark1.Text & "'and Password='" & Watermark2.Text & "' ", conn)
dapt.Fill(tbl)

pass1 = Watermark2.Text
If tbl.Rows.Count > 0 Then
splash.Show()
Me.Hide()

Else

My.Computer.Audio.PlaySystemSound(
System.Media.SystemSounds.Exclamation)


Watermark1.Focus()
Panel5.Show()
PictureBox2.Image = Payroll.My.Resources.Login_01error
PictureBox3.Image = Payroll.My.Resources.User_Profileerror





End If
End Sub



Private Sub PictureBox4_Click(sender As Object, e As EventArgs) Handles PictureBox4.Click

End Sub

Private Sub Watermark1_TextChanged(sender As Object, e As EventArgs) Handles Watermark1.TextChanged
Panel5.Hide()

PictureBox3.Image = Payroll.My.Resources.User_Profile1

End Sub

Private Sub Watermark2_TextChanged(sender As Object, e As EventArgs) Handles Watermark2.TextChanged
Panel5.Hide()
PictureBox2.Image = Payroll.My.Resources.password
End Sub

Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked

ResetForm.ShowDialog()

End Sub

Private Sub LinkLabel2_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel2.LinkClicked
ResetForm.ShowDialog()
End Sub

Private Sub LinkLabel3_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel3.LinkClicked
Panel8.Show()
Panel11.Hide()

End Sub

Private Sub BunifuTileButton1_Click_1(sender As Object, e As EventArgs) Handles RegBtn.Click

End Sub
End Class


All times are GMT -4. The time now is 02:19 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.