How to Change the Database Password Programmatically?
Language:
Visitors have accessed this post 25124 times.
This tutorial will teach you on how to change the database password of an Access database programmatically using visual basic 6.0.
CN.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DatabasePath & ";Persist Security Info=False;Mode=12;Jet OLEDB:Database Password="current password here"
sqlExecStr = "ALTER Database Password " & txtNewPass & " " & txtOldPass & ";" CN.Execute sqlExecStr
Where CN is your database connection variable.
If you use the database before changing the password be sure to close it by adding code like:
CN.close
Open the database exclusively by adding:
Mode=12;
This is very important since you cannot change the password if you did not open it exclusively.
- Add new comment
- 25124 reads
Comments
Anonymous (not verified)
Mon, 03/18/2013 - 16:39
Permalink
error while executing alter query
hi i tried the code mentioned at topmost however i get the error "method execute of object objConnection failed however i confirm the file is open with mode=12 what could be the reason
Anonymous (not verified)
Tue, 10/19/2010 - 13:13
Permalink
VB
I am vb programmer
Anonymous (not verified)
Fri, 04/30/2010 - 11:22
Permalink
how to use combo box in vb6
Hi Everyone,
Can I know how to use combo box when I click the first combo box , the second combox also change to display data related to first combo box?
I'm just start to learn vb6 and i'm new in this language. Can anyone help me please..
Thank you very much..
Anonymous (not verified)
Mon, 03/22/2010 - 15:54
Permalink
Change Password query error
My code is as follows,
------------------
Set con = New ADODB.Connection
Dim strConstring As String, strChgPw
Dim newPassword As String
Dim oldpassword As String
newPassword = "Sid"
oldpassword = "Null"
strConstring = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=MGallary;Data Source=SIDDHESH-DFF718"
con.Open strConstring
strChgPw = "ALTER Database Password " & newPassword & " " & oldpassword & ";"
con.Execute strChgPw
---------------------------------
But while running it promts error for line
con.Execute strChgPw
as: Incorrect syntax error near keyword 'Null'
I have not set any password for my database
Please help
Anonymous (not verified)
Fri, 10/14/2011 - 01:53
Permalink
coonection
also close the connection after
con.Execute strChgPw
write here con.close
Anonymous (not verified)
Fri, 02/26/2010 - 20:56
Permalink
codes for changing password through vb 6.0
is there more understandable code for changing password using vb 6.0??:) thanks
Anonymous (not verified)
Sat, 05/29/2010 - 02:44
Permalink
How to change my password?
Hi there!
I would like to change my password that is stored on the database?
Anonymous (not verified)
Thu, 09/03/2009 - 18:22
Permalink
password
hi i declared my obeject as folloes but it complains.here is the code
Dim objUser As User
If txtUsername.Text <> "" Then
If txtNewPassword.Text = txtConfirmNew.Text Then
objUser = GetObject("LDAP://cn=" + txtUsername.Text _
+ ",cn=Users,dc=mycorp,dc=com")
objUser.SetPassword(txtNewPassword.Text)
objUser.pwdLastSet = 0
objUser.lockoutTime = 0
objUser.SetInfo()
'Reset everything
txtUsername.Text = ""
txtNewPassword.Text = ""
txtConfirmNew.Text = ""
MsgBox("Password changed!")
Else
MsgBox("Passwords are not the same, please try again!")
End If
Else
MsgBox("A username must be specified!")
End If
admin
Fri, 09/04/2009 - 12:10
Permalink
re: password
What is the error you encounter?
Anonymous (not verified)
Tue, 08/18/2009 - 17:45
Permalink
An Example
Thats How i got it to work :D
admin
Wed, 08/19/2009 - 13:24
Permalink
re: An Example
Good
Anonymous (not verified)
Fri, 07/31/2009 - 14:01
Permalink
VB.NET
HOW CAN ME WRITE IT IN VISUAL BASIC 2008
AND HOW CAN ME CREATE NEW PASSWORD FOR ACCESS 2003
Anonymous (not verified)
Thu, 07/02/2009 - 22:46
Permalink
how did you initialized the
how did you initialized the CN variable? please send me the answer here [email protected]
admin
Fri, 07/03/2009 - 11:22
Permalink
re: how did you initialized the
Public CN As New Connection
Anonymous (not verified)
Sat, 04/25/2009 - 11:52
Permalink
What A great Job
I am a regular beneficiary of your tips and helps, keep up the good job. I must tell you, am inpressed by your selfless devotion to helping developers.
Anonymous (not verified)
Mon, 03/09/2009 - 16:58
Permalink
database password
what is the databse password .
my id is [email protected]
admin
Mon, 03/09/2009 - 17:11
Permalink
re: database password
Please read FAQ.
admin
Sat, 01/24/2009 - 11:39
Permalink
re: password
Search for term "password" in the code editor window. Be sure to select current project.
barbyan
Sat, 01/24/2009 - 01:29
Permalink
password
how do i get the password to the downloaded VOTING SYSTEM software?
Add new comment