473,401 Members | 2,139 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

Password System

I am newbie here. I need some help regarding password matter.
like how to matching password after make a password
I am making some banking systemeg: password is 45by89ki
how to matching the password in text

another problem is how to save data automatically into access
Sep 8 '08 #1
2 1278
OuTCasT
374 256MB
Create a function to validate the password inserted in the textbox to the one stored in the database

Expand|Select|Wrap|Line Numbers
  1. Private Function ValidateCompany(ByVal passWord As String) As Boolean
  2.         Dim conn As SqlConnection
  3.         Dim cmd As SqlCommand
  4.         Dim lookupPassword As String
  5.  
  6.         lookupPassword = Nothing
  7.  
  8.         ' Check for an invalid userName.
  9.         ' userName  must not be set to nothing and must be between one and 15 characters.
  10.         If ((passWord Is Nothing)) Then
  11.             MsgBox("Incorrect Company Password, Please Try again.", MsgBoxStyle.Critical)
  12.             Return False
  13.  
  14.         End If
  15.         Try
  16.             ' Consult with your SQL Server administrator for an appropriate connection
  17.             ' string to use to connect to your local SQL Server.
  18.  
  19.             conn = New SqlConnection("Server=(local);Data Source=.\sqlexpress;Initial Catalog='" & TextBox1.Text & "';Integrated Security=True")
  20.             conn.Open()
  21.  
  22.             ' Create SqlCommand to select pwd field from the users table given a supplied userName.
  23.             cmd = New SqlCommand("SELECT CompanyPassword from CompanyParameters where CompanyPassword=@CompanyPassword", conn)
  24.             cmd.Parameters.Add("@CompanyPassword", SqlDbType.VarChar, 25)
  25.             cmd.Parameters("@CompanyPassword").Value = passWord
  26.  
  27.  
  28.             ' Execute command and fetch pwd field into lookupPassword string.
  29.             lookupPassword = cmd.ExecuteScalar()
  30.  
  31.             ' Cleanup command and connection objects.
  32.             cmd.Dispose()
  33.             conn.Dispose()
  34.         Catch ex As Exception
  35.             ' Add error handling here for debugging.
  36.             ' This error message should not be sent back to the caller.
  37.             MsgBox("Incorrect Company Password, Please Try again.", MsgBoxStyle.Critical)
  38.         End Try
  39.  
  40.         ' If no password found, return false.
  41.         If (lookupPassword Is Nothing) Then
  42.             ' You could write failed login attempts here to the event log for additional security.
  43.             Return False
  44.         End If
  45.  
  46.         ' Compare lookupPassword and input passWord by using a case-sensitive comparison.
  47.         Return (String.Compare(lookupPassword, passWord, False) = 0)
  48.  
  49.     End Function 
on a button click you would call the function

Expand|Select|Wrap|Line Numbers
  1. If ValidateCompany(txtPassword.Text) Then
  2. ........
  3. else
  4. If ValidateCompany(txtPassword.Text) = false Then
  5. end if
Oct 14 '08 #2
debasisdas
8,127 Expert 4TB
if userid & password is stored in database then

1.make userid the Primay key (to avoid duplicate or null entry)
2.check the userid/password from frontend after user input by using COUNT in database
3.proceed further on successful login else reprompt to enter the correct username/password.
Oct 15 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Sigi | last post by:
Hi guys. I am new member in this group. I am also new to Visual C++. I am developing a new system. I have a password to enter the system. The user should have a choice to change his/her password...
10
by: Fabrizio | last post by:
(Sorry for the crosspost, but I really don't know which is the right newsgroup!) Hi all, I try to change the password to a user that as to change the password at first logon: try {
0
by: Yannick Béot | last post by:
Hi, I'm trying to make an application that allow a user, through a web form to change its password On a click event, here is the code DirectoryEntry usr = new DirectoryEntry( theUserDN,...
5
by: scorpion53061 | last post by:
is it possible to set the database password that you can set in access for a database from a vb.net application?
5
by: newbie | last post by:
Hello, I face a practical problem with encryption. I've read examples for encrypting a file with the DES algorythm. The algorythm uses a key and a IV value. Both are 8 bytes if I'm correct,...
10
by: Niyazi | last post by:
Hi, I developed an application and I am using SQL Server 2000 developer edition. I create my database and I have also created tbl_USER table. I have an ID, RealName, UserName, and UserPassword...
0
by: Kirk | last post by:
The following C# web service works fine until you uncomment the lines setting UserName and Password. Then, Process.Start throws an Access is Denied Exception. This is with .NET 2.0, of course...
30
by: diane | last post by:
I've got an application running with table-based security: i capture the user's windows login with fOsusername, then have them enter a password checked against their username/login in my own table....
3
by: Porkie999 | last post by:
-----------------------------------------------------------------------QUESTION hi i am really stuck with this and its only a small problem. i want to be able to type ......... dsfsjfjsjjfs in...
0
by: calvinkwoo3000 | last post by:
My Window application run property withour link to mdb without password. Once i set security password to mdb file, the error belor come out when i click detail. Not a valid password. and detail...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.