473,503 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to change password using access as database?

12 New Member
please can anyone help me?
im currently working in a project and i already made a code for the login, the only thing is that i dont know how to update the records(Username/Password) in access using VB 2010. well i can update by manually changing the content of my table but i like to have it change using an interface in my vb named Manage account...

thank you in advance.
Feb 4 '11 #1
9 5359
timr30017
9 New Member
Hey!

I don't know if you mean you want to change the username/passwords that are or can be integrated with Access by enabling security or if you have a table that contains username and passwords.

If it is the later case then you should be able to do something like so by adding a DataBindingSource to your form you use to Manage account.

Expand|Select|Wrap|Line Numbers
  1.  Me.SettingsBindingSource.MoveFirst()
  2.                 Me.SettingsBindingSource.RemoveCurrent()
  3.                 Me.Validate()
  4.                 Me.SettingsBindingSource.EndEdit()
  5.                 Me.TableAdapterManager.UpdateAll(Me.RecruitingDataSet)
  6.                 Me.SettingsBindingSource.AddNew()
You will just need to modify this code a bit above to find the correct user then delete their username/password and add it back using the Addnew method.

Then be sure to do this:

Expand|Select|Wrap|Line Numbers
  1.  Me.Validate()
  2.                 Me.SettingsBindingSource.EndEdit()
  3.                 Me.TableAdapterManager.UpdateAll(Me.RecruitingDataSet)
  4.             Else
  5.                 MessageBox.Show("The passwords do not match - please try again.")
  6.             End If
Feb 4 '11 #2
dexter delleva
12 New Member
i do have a table that contains username and password. and there are 3 default username and password that can be use to login. if i were the Admin(one of the user) i can login using the default password for the username admin and at the same time to enforce security i can update or change may accounts password.

thanks for your reply. I'll try this.
Feb 4 '11 #3
dexter delleva
12 New Member
im confuse, how can i compare the if statement in the code directly to password only.
" if me.validate () = ? then
Me.SettingsBindingSource.EndEdit() Me.TableAdapterManager.UpdateAll(Me.RecruitingData Set)"

is my logic right?? sorry for not understanding well, im not really good in coding^^
Feb 4 '11 #4
timr30017
9 New Member
No what you want to find and compare is the record you want to change so if say the user name is admin you will do something like the following. But the trick I used was to put a textbox field on the form. IF you don't want the user to see it so your app stays all 'pretty' just either change all the colors to the same as the form's background OR hide it (send to back) behind another control on the form. Then:

let's say your admin name is displayed in textbox1 and your hidden textbox is called textbox2 - oh and use one more to put the new password into or ever how you might want to do this.

Expand|Select|Wrap|Line Numbers
  1. if textbox1.text = textbox2.text then
  2.                 Me.SettingsBindingSource.RemoveCurrent()
  3.                 Me.Validate()
  4.                 Me.SettingsBindingSource.EndEdit()
  5.                 Me.TableAdapterManager.UpdateAll(Me.YourDataSourceNameHERE)
  6. end if
  7. ' now add your new record back
  8.         Me.SettingsBindingSource.AddNew()
  9.         textbox2.text = "adminuser"        
  10.         textbox3.text = "mynewpassword"
  11.         Me.Validate()
  12.         Me.SettingsBindingSource.EndEdit()
  13.         Me.TableAdapterManager.UpdateAll(Me.YourDataSourceNameHERE)
  14.  
This isn't the prettiest way to do this but this is exactly how I hide what is going on behind the scenes when I encrypt a username, product key, and activation code when the user actually activates my software.

It is kind of quirky but this is what I came up with late one night after working on some code to do ALL the above for like 9 hrs.
Feb 4 '11 #5
timr30017
9 New Member
oh i forgot one thing. Instead of just

END IF

do

ELSE ' this not the right record
settingsbindingsource.movenext()
END IF

But now thinking about it you will want to use a while statement or some kind of loop to ensure you get to the right record you want to change.
Feb 4 '11 #6
dexter delleva
12 New Member
does the "Me.YourDataSourceNameHERE" signifies the dataadapter??
im going to try this... btw ive been working on a code i found on other sources and tried it but cant seem to figure out whats wrong.

this is the code:

Dim i, rwno As Integer
Dim colname As String
Dim value As Object
colname = "Password"
rwno = 0
value = TextBox3.Text
Try

''Update the column in the Student table. _Museum_finalDataSet11.Tables(0).Rows(1).Item(colu mnName:=colname) = value
'Update the Student table in the testdb database.
i = LoginTableAdapter1.Update(_Museum_finalDataSet11)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
'Displays number of rows updated.
MessageBox.Show("no of rows updated=" & i)
Feb 4 '11 #7
dexter delleva
12 New Member
does the "Me.YourDataSourceNameHERE" signifies the dataadapter??
im going to try this... btw ive been working on a code i found on other sources and tried it but cant seem to figure out whats wrong.

message box appears saying that "there is no row at position 1" but the password column in my table is row 1.

this is the code:
[list][*]Dim i, rwno As Integer[*] Dim colname As String[*] Dim value As Object[*] colname = "Password"[*] rwno = 0[*] value = TextBox3.Text[*] Try[*] [*] ''Update the column in the Login table.
  • _Museum_finalDataSet11.Tables(0).Rows(1).Item(colu mnName:=colname) = value
  • 'Update the login table in the Museum-final database.
  • i = LoginTableAdapter1.Update(_Museum_finalDataSet11)
  • Catch ex As Exception
  • MessageBox.Show(ex.Message)
  • End Try
  • 'Displays number of rows updated.
MessageBox.Show("no of rows updated=" & i)
Feb 4 '11 #8
dexter delleva
12 New Member
i really find it hard to understand.. im sorry. but i'll keep trying until i got it right.^^ tnx
Feb 4 '11 #9
dexter delleva
12 New Member
finally found a way how to change the password... tnx!
Feb 6 '11 #10

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

Similar topics

4
2642
by: Nicolae Fieraru | last post by:
Hi All, I am working on a web site in asp which will be hosted on a Windows 2003 server. I use the following code to connect to the database: Set objConn =...
0
4173
by: Mike Knight | last post by:
(I've also posted this problem on microsoft.public.excel.programming) I have a MS Access 2003 Database named "AS400 Fields.mdb". This database contains links to tables on an AS400. In MS...
1
3384
by: webmaster | last post by:
I have a password protected Access Database (.MDB) file. I also have a Crystal Report with database fields connected to table in this database. I want to display the Crystal Report Preview Form...
1
1243
by: Bob Alston | last post by:
Anyone interested in using an Access database in an internet environment might be interested in reading the summary of my journey in this direction. I tried several web development environments,...
4
5894
by: Scott Nicholson | last post by:
I've got a site set up that uses a network share as it's home directory. Simple stuff is working fine. When I try to put a database in there, though, I run into problems. I'm using: dim...
1
1611
by: Daniel | last post by:
Hello everyone, I am trying to connect to a password protected Access database using: Public connString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & pathDB & ";User...
2
2635
by: Felix Melendez | last post by:
Hi there! I'd like to know if anyone out there can give me a helping hand. I've developed an asp.net application that uses Forms Authentication. Question: I'd like to give users the ability...
1
1117
by: MA P | last post by:
Hi! I am use to the include file on classic asp for maintaining MS Access database location. On using Visual Web Developer Express, I can only use the MS Access database if it is located on the...
0
1371
by: agent47 | last post by:
I don't know what the problem is with this query. It seems correct, but I guess it is not since it is not working. I'm using access as a database and C# language. Below is my sql text.. ...
4
3099
by: dillneus | last post by:
Hey I must do the News Storage database. It sounds pretty easy but there is one point I don't know how to do. When I download the news file and save it in .pdf. I have database that records all...
0
7086
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
7332
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6991
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
7462
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...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.