Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 16th, 2006, 06:18 AM
Registered User
 
Join Date: Jan 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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..


 
Old January 16th, 2006, 01:24 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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.
 
Old January 31st, 2011, 03:44 PM
Registered User
 
Join Date: Jan 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Question 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
 
Old February 1st, 2011, 03:37 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old November 27th, 2016, 02:47 AM
Registered User
 
Join Date: Nov 2016
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Case sensitive search prabodh_mishra SQL Server 2000 6 June 10th, 2008 04:54 AM
Case Sensitive hymavathy_kr VB Databases Basics 1 August 10th, 2007 06:43 AM
making login case sensitive with mysql database crmpicco MySQL 0 August 18th, 2006 05:48 AM
How to do case sensitive comparison in SQL SERVER leo_vinay Classic ASP Databases 2 January 24th, 2005 01:46 PM
Check Case in a Case-Insensitive DB nbryson SQL Language 1 January 23rd, 2004 07:36 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.