-
Access Data Base Security
I want to Secure my Data base which is distributed with my VB application
. I am using ADODB connection to connect with my databae, but i am unable
to open it .This password is for only data base security .My code is as follows.
Private Sub Form _Load()
set myConn = New adodb.Connection
strconnect = App.Path & "\wisdom\dbc.mdb"
myConn.Provider="Microsoft.Jet.OLEDB.3.5.1"
myConn.open strConnect, "Admin" ,"password",
End Sub
Private sub Listbookonly-DBlclick()
strAnswer = Listbookonly .Text
Set myRS = New adodb.Recordset
StrSQL = "Select [Title] , [Name of Book], [Page number (E)] from Hikmat
where [Name of Book] like "&"'%" & StrAnswer &"%"'
myRs.open strSQL ,myconn,adOpenKeyset,adLockOptimistic,adcmdText
End sub
Where Hikmat is the name of my table in database dbc.mdb
Please suggest is any syntax error or some other code is needed
Thanks
Irfan
-
Re: Access Data Base Security
Sorry to disappoint you, but the Database Password "feature" of Access 97 is
extremely poor, and really doesn't offer you any protection whatsoever.
Michael Kaplan's posted free code to retrieve the password at
http://www.trigeminal.com/lang/1033/codes.asp?ItemID=5
If you are going to persist in using it, see whether the connection strings
Carl Prothman has at http://www.able-consulting.com/ADO_Conn.htm are of any
help to you.
--
Doug Steele, Microsoft Access MVP
Beer, Wine and Database Programming. What could be better?
Visit "Doug Steele's Beer and Programming Emporium"
http://I.Am/DougSteele/
"Irfan" <vertejee@cyber.net.pk> wrote in message
news:3a1df1c1$1@news.devx.com...
>
> I want to Secure my Data base which is distributed with my VB application
> I am using ADODB connection to connect with my databae, but i am unable
> to open it .This password is for only data base security .My code is as
follows.
> Private Sub Form _Load()
>
> set myConn = New adodb.Connection
>
> strconnect = App.Path & "\wisdom\dbc.mdb"
>
> myConn.Provider="Microsoft.Jet.OLEDB.3.5.1"
>
> myConn.open strConnect, "Admin" ,"password",
>
> End Sub
>
>
> Private sub Listbookonly-DBlclick()
>
> strAnswer = Listbookonly .Text
>
> Set myRS = New adodb.Recordset
>
> StrSQL = "Select [Title] , [Name of Book], [Page number (E)] from Hikmat
> where [Name of Book] like "&"'%" & StrAnswer &"%"'
>
> myRs.open strSQL ,myconn,adOpenKeyset,adLockOptimistic,adcmdText
>
>
> End sub
>
> Where Hikmat is the name of my table in database dbc.mdb
> Please suggest is any syntax error or some other code is needed
>
> Thanks
>
> Irfan
-
Re: Access Data Base Security
"Irfan" <vertejee@cyber.net.pk> wrote:
>
>I want to Secure my Data base which is distributed with my VB application
>. I am using ADODB connection to connect with my databae, but i am unable
>to open it .This password is for only data base security .My code is as
follows.
>Private Sub Form _Load()
>
>set myConn = New adodb.Connection
>
>strconnect = App.Path & "\wisdom\dbc.mdb"
>
>myConn.Provider="Microsoft.Jet.OLEDB.3.5.1"
>
>myConn.open strConnect, "Admin" ,"password",
>
>End Sub
>
>
>Private sub Listbookonly-DBlclick()
>
>strAnswer = Listbookonly .Text
>
>Set myRS = New adodb.Recordset
>
>StrSQL = "Select [Title] , [Name of Book], [Page number (E)] from Hikmat
>where [Name of Book] like "&"'%" & StrAnswer &"%"'
>
>myRs.open strSQL ,myconn,adOpenKeyset,adLockOptimistic,adcmdText
>
>
>End sub
>
>Where Hikmat is the name of my table in database dbc.mdb
>Please suggest is any syntax error or some other code is needed
>
>Thanks
>
>Irfan
It is not myConn.Provider="Microsoft.Jet.OLEDB.3.5.1"
But is myConn.Provider="Microsoft.Jet.OLEDB.3.51"
That little adjustment should allow you to connect
-
Re: Access Data Base Security
You may be aware Access has 2 "levels' of security. One only requires a password
to the database with no other changes to the system.mdw file.
The second requires a MDW file and allows you to set individual user permissions
for table acesss etc.
Below are to routines which demonstrate how to connect to to secured Access
database.
the 1st uses a MDW file the 2nd only uses a password in the database. Sounds
like you would just need the 2nd method.
Public Sub OpenSecuredDB()
'uses a MDW file with user level security
Dim sConn As String, adoCon As ADODB.Connection
Dim sDBName As String, sSecurityDBName As String
Dim sUserID As String, sPassword As String, sDatabasePassword As String
sDBName = "YourDatabasename.mdb"
sSecurityDBName = "YourMDWFile.mdw"
sUserID = "YourUserID"
sPassword = "YourUserIDPassword"
sDatabasePassword = "YourDatabasePassword"
sConn = "Provider=Microsoft.Jet.OLEDB.4.0" & _
";Password=" & sPassword & _
";User ID=" & sUserID & _
";Data Source=" & sDBName & _
";Persist Security Info=True" & _
";Jet OLEDB:System database=" & sSecurityDBName
Set adoCon = New ADODB.Connection
With adoCon
.Open sConn
Debug.Print "Connection opened: " & CStr((.State And adStateOpen) = adStateOpen)
.Close
End With
Set adoCon = Nothing
End Sub
Public Sub OpenSecuredDBPasswordOnly()
'only requires a password to open the database
Dim sConn As String, adoCon As ADODB.Connection
Dim sDBName As String, sDatabasePassword As String
sDBName = "YourDatabasename.mdb"
sDatabasePassword = "YourDatabasePassword"
sConn = "Provider=Microsoft.Jet.OLEDB.4.0" & _
";Data Source=" & sDBName & _
";Persist Security Info=True" & _
";Jet OLEDB atabase Password=" & sDatabasePassword
Set adoCon = New ADODB.Connection
With adoCon
.Open sConn
Debug.Print "Connection opened: " & CStr((.State And adStateOpen) = adStateOpen)
.Close
End With
Set adoCon = Nothing
"Irfan" <vertejee@cyber.net.pk> wrote:
>
>I want to Secure my Data base which is distributed with my VB application
>. I am using ADODB connection to connect with my databae, but i am unable
>to open it .This password is for only data base security .My code is as
follows.
>Private Sub Form _Load()
>
>set myConn = New adodb.Connection
>
>strconnect = App.Path & "\wisdom\dbc.mdb"
>
>myConn.Provider="Microsoft.Jet.OLEDB.3.5.1"
>
>myConn.open strConnect, "Admin" ,"password",
>
>End Sub
>
>
>Private sub Listbookonly-DBlclick()
>
>strAnswer = Listbookonly .Text
>
>Set myRS = New adodb.Recordset
>
>StrSQL = "Select [Title] , [Name of Book], [Page number (E)] from Hikmat
>where [Name of Book] like "&"'%" & StrAnswer &"%"'
>
>myRs.open strSQL ,myconn,adOpenKeyset,adLockOptimistic,adcmdText
>
>
>End sub
>
>Where Hikmat is the name of my table in database dbc.mdb
>Please suggest is any syntax error or some other code is needed
>
>Thanks
>
>Irfan
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
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks