-
Jan 22nd, 2021, 01:45 PM
#1
Thread Starter
PowerPoster
ado connection with password
Code:
Public Sub APRI_CON()
Set CON = New ADODB.Connection
' APRI CONNESSIONE
With CON
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Open strDBPath
End With
End Sub
my conn.
but if the database have a password i recive a error, "database password incorrect"
i can allert the user for that?
naturally exist sub if have errors i
-
Jan 22nd, 2021, 03:13 PM
#2
Junior Member
Re: ado connection with password
Hi could you try this cnn string
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;Jet OLEDBatabase Password=MyDbPassword;
source https://www.connectionstrings.com/mi...et-ole-db-4-0/
-
Jan 22nd, 2021, 03:20 PM
#3
Thread Starter
PowerPoster
Re: ado connection with password
Originally Posted by federico07
Hi!
I know this way, but i need to know if the database have a password protected, before Open it...
-
Jan 22nd, 2021, 05:03 PM
#4
Re: ado connection with password
well...if it fails when you attempt to open it without a password, ...guess what? it needs a password.
Why not just attempt to open and trap the error?
See this thread on how to do just that: https://social.msdn.microsoft.com/Fo...orum=vbgeneral
Sam I am (as well as Confused at times).
-
Jan 22nd, 2021, 05:15 PM
#5
Thread Starter
PowerPoster
Re: ado connection with password
Originally Posted by SamOscarBrown
I have see....
But i'm on vb6 not vbnet...
-
Jan 22nd, 2021, 05:34 PM
#6
Re: ado connection with password
First you need share access. Then the above only gets one foot into the database itself. Next comes the user ID if the default "Admin" isn't right, then password, if one has been set.
So there are three possible levels of access control to consider.
-
Jan 22nd, 2021, 07:55 PM
#7
Re: ado connection with password
sorry about the .Net link.... :-(
Sam I am (as well as Confused at times).
-
Jan 22nd, 2021, 10:57 PM
#8
Re: ado connection with password
i need to know if the database have a password protected, before Open it...
ask the user (fill in textbox or whatever), then change the login to suit
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
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
|