区分大小写的VB 2012使用msaccess [英] Case sensitive VB 2012 using msaccess
本文介绍了区分大小写的VB 2012使用msaccess的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
它工作正常但不区分大小写。请帮助
我的数据库看起来像 [ ^ ]
我尝试过:
it works fine but not case sensitive. pls help
my database looks like [^]
What I have tried:
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
Watermark1.Focus()
Panel5.Hide()
Panel13.Hide()
Label7.Hide()
Label8.Hide()
Timer1.Enabled = False
Panel8.Hide()
MyConnection()
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 Username='" & Watermark1.Text & "'and Password='" & Watermark2.Text & "' ", conn)
dapt.Fill(tbl)
pass1 = Watermark2.Text
If tbl.Rows.Count > 0 Then
Timer1.Enabled = True
Panel13.Show()
Label7.Show()
Label8.Show()
Else
My.Computer.Audio.PlaySystemSound(
System.Media.SystemSounds.Exclamation)
Panel5.Show()
PictureBox2.Image = Payroll.My.Resources.Login_01error
PictureBox3.Image = Payroll.My.Resources.User_Profileerror
Watermark1.Focus()
Watermark2.Clear()
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
Private Sub BunifuImageButton1_Click(sender As Object, e As EventArgs) Handles BunifuImageButton1.Click
Me.Close()
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
loading.Value = loading.Value + 1
Label6.Text = loading.Value & "%"
Label8.Text = loading.Value & "%"
If (loading.Value = loading.MaximumValue) Then
System.Threading.Thread.Sleep(3000)
Timer1.Enabled = False
Me.Hide()
MainForm.Show()
End If
End Sub
Private Sub Panel4_Paint(sender As Object, e As PaintEventArgs) Handles Panel4.Paint
End Sub
End Class
推荐答案
我认为这是导致问题的密码:不要那样做!
绝不存储密码文本 - 这是一个主要的安全风险。
基于文本的密码 [ ^ ]
这里有一些关于如何正确执行此操作的信息:密码存储:怎么做。 [ ^ ] - 它在C#中,但它的代码非常简单,在线转换器应该能够为您翻译:代码转换器 [ ^ ]
I assume it's your passwords that are causing the problem: don't do it like that!
Never store passwords in clear text - it is a major security risk.
Text based passwords[^]
There is some information on how to do it properly here: Password Storage: How to do it.[^] - it's in C#, but it's pretty simple code, and an online converter should be able to translate it for you: Code Converter[^]
这篇关于区分大小写的VB 2012使用msaccess的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文