-
Apr 8th, 2015, 12:17 AM
#1
Thread Starter
Member
Login System in Visual Studio 2010
Hello ! I am making a login system in visual studio 2010 . I used this code and it works fine !
Code:
My.Settings.Username = TextBox1.Text
My.Settings.Password = TextBox2.Text
My.Settings.Save()
MsgBox("Account Created !", MsgBoxStyle.Information, "Create")
The only problem is that when it only remembers my username and password untill I close my project's .exe file . After I close it and reopen it all the saved data gets deleted . Could you help me by telling that how can I build a login system in which the data should not get lost even after I close the .exe file ? Many thanks !
-
Apr 8th, 2015, 03:54 AM
#2
Re: Login System in Visual Studio 2010
You can't using that method, as each time you enter a new user and password it will write over the last one.
The settings file is a terrible place to hold username / password information, as it completely insecure.
If you want to have multiple users of your system then you will need to use a database here is decent example of how you might go about it.
Please Mark your Thread "Resolved", if the query is solved & Rate those who have helped you
-
Apr 8th, 2015, 06:40 AM
#3
Lively Member
Re: Login System in Visual Studio 2010
Originally Posted by NeedSomeAnswers
You can't using that method, as each time you enter a new user and password it will write over the last one.
The settings file is a terrible place to hold username / password information, as it completely insecure.
If you want to have multiple users of your system then you will need to use a database here is decent example of how you might go about it.
Hi. Thats a nice guide, but I cannot find and understand where is the code that actually checks if the password and username is wrong or correct.
-
Apr 8th, 2015, 08:11 AM
#4
Re: Login System in Visual Studio 2010
That's in Section 9, (the second black back-grounded code block).
This is the code he uses - >
Dim sql As String = "SELECT * FROM tbl_user WHERE username='" & txtUsername.Text & "' AND password = '" & txtPassword.Text & "'"
Dim sqlCom As New System.Data.OleDb.OleDbCommand(sql)
'Open Database Connection
sqlCom.Connection = conn
conn.Open()
Dim sqlRead As System.Data.OleDb.OleDbDataReader = sqlCom.ExecuteReader()
So basically he doesn't compare username and password exactly as checks to see if any users exist in the database with that Username & Password. If non exist then the user doesn't exist !
There are a number of issues with his code now i look at it closer specifically he doesn't use Parameters, but if you follow it all the way through then it should give you a good idea about how to get started, and i (and plenty of others here) can show you how to use parameters.
If you try and create your own Login system i will be more then happy to help with your code. Just post what you are trying out and i will see how i can help.
Please Mark your Thread "Resolved", if the query is solved & Rate those who have helped you
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|