VB6中区分大小写的密码 [英] Case Sensitive password in VB6

查看:159
本文介绍了VB6中区分大小写的密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友们

我试图在vb6中创建一个登录表单并访问2007.它工作正常,但它不区分大小写。如果我输入小写或大写的用户名或密码,它会登录我。

如何使区分大小写。

它可以在Vb6上使用。

我试过strcomp()但没有成功。

请帮助



Sarfaraz

Dear friends
I was trying to make a login form in vb6 and access 2007. It worked fine but it is not case sensitive. If i type username or password in lower case or uppercase it is logging me in.
How can i make it case sensitive.
It it possible on Vb6.
I tried strcomp() but no success.
Please help

Sarfaraz

推荐答案

你的错误是你发送用户名和密码来检查数据库,

所有SQL查询和它的参数都不区分大小写...

所以我已经更新了你的Source将UserName发送到数据库并从中检索密码,之后你可以使用简单IF条件比较两个文本...

这里这是我的解决方案,它会工作......



Your Mistake is that you''ve Send Username with Password to Check in Database,
All SQL Queries and it''s Paramaeters are not Case Sensitive...
So Now I''ve Updated your Source Which send UserName to Database and Retrieve Password from it, After that You can compare both text using Simple IF condition...
Here''s my Solution, It''ll work...

Set rs = New ADODB.Recordset
Qry = "SELECT Password FROM Login WHERE UserName = '" & Text1.Text & "'"
rs.Open Qry, Con, adOpenDynamic, adLockOptimistic    
If Not rs.EOF Then
    If rs(0) = Text2.Text Then  ' rs(0) may be written as rs.Fields(0) try both
        MsgBox "OK" 
    Else
        Msgbox "Invalid Username or Password", vbInformation, "Login..."
    End If
Else
    MsgBox "Invalid Username or Password", vbInformation, "Login..."
    Text1.Text = ""
    Text2.Text = ""
End If
rs.Close
Text1.SetFocus     






看看这里:

http://stackoverflow.com/questions/813335/is-vb6-string-comparison-case-insensitive [ ^ ]


你好Sarfaraz



你做得很好,对于档案馆e,再做一件事就是写一个加密和解密函数



加密它,同时存储用户名和密码。



在登录期间,首先必须加密用户名和密码以进行比较。



如果要在某些位置显示用户名,例如审计跟踪那时你必须解密用户名。



查找以下加密/解密链接....

http://support.microsoft.com/kb/821762 [ ^ ]

http://www.developerfusion.com / code / 157 / encryptdecrypt / [ ^ ]



问候,

Vijay
Hi Sarfaraz

You are doing well,For archive that, do one more thing write a function for encryption and decryption

Encrypt it, while storing username and password.

During log in, first you have to encrypt the user name and password for comparison.

If you want to show User Name some where like Audit trail at that time you have to Decrypt the username.

Find below link for encryption/Decryption....
http://support.microsoft.com/kb/821762[^]
http://www.developerfusion.com/code/157/encryptdecrypt/[^]

Regards,
Vijay


这篇关于VB6中区分大小写的密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆