MS Access problems

J

Jan Janssen

Hi there,

I'm currently rewriting an old VB 6 (stand alone) application in VB .Net
2003 in which users can create MS Access databases. In the new version I
want to add security options like encrypting the database, adding users and
groups etc.

I managed to create MS access databases and tables using ADOX, but I can't
add users and groups to it. I use the following code:

Dim myCat as New ADOX.Catalog
Dim myCon as OleDb.OleDbConnection
Dim myConStr as String
Dim myNewUser as ADOX.User
Dim myNewGroup as ADOX.Group

Try
myConStr = "Provider=Microsoft.Jet.OLEDB.4.0; Jet oledb:system
database=system.mdw;" & _
"Data Source=C:\Test.mdb"
'Creating the database
myCat.Create(myConStr)
myCon = New OleDb.OleDbConnection(myConStr)
myCon.Open()

myCat.ActiveConnection = myCon <<-- This seems to be the problem
after debugging the code

'Creating a new group
myCat.Groups.Append("User group")
'Creating a new user
myNewUser = New ADOX.User
myNewUser.Name = "Jan Janssen"
myCat.Users.Append(myNewUser)
'Add new user to the new group
myNewUser.Groups.Append("User Group")

myCon.Close()
myCat = Nothing
myCon = Nothing
Catch ex as Exception
MessageBox.Show(ex.Message)
End Try

When executing this code the following error occurs: "Interface not
supported"

Can anyone help me out or is there an alternative approach without using SQL
servers?

thnx
 
G

Guest

Hi Dear Jan Janssen,

Why don't you use in the first place SQL Server 2005 Express Edition or else

MSDE 2000 for Developers Using Visual Studio .NET

you can download these here;

SQL Server 2005 Express Edition
=====================
http://www.microsoft.com/downloads/...78-60a6-4b11-8aa8-bf12261a303a&DisplayLang=en


MSDE 2000 for Developers Using Visual Studio .NET
-----------------------------------------------------------

http://www.microsoft.com/sql/editions/express/howtobuy.mspx

MSDE 2000
========
Microsoft SQL Server 2000 Desktop Engine (MSDE 2000) Release A
-----------------------------------------------------------------------------

http://www.microsoft.com/downloads/...d1-a0bc-479f-bafa-e4b278eb9147&DisplayLang=en

Bye
Venkat_KL
 
P

Paul Clement

¤ Hi there,
¤
¤ I'm currently rewriting an old VB 6 (stand alone) application in VB .Net
¤ 2003 in which users can create MS Access databases. In the new version I
¤ want to add security options like encrypting the database, adding users and
¤ groups etc.
¤
¤ I managed to create MS access databases and tables using ADOX, but I can't
¤ add users and groups to it. I use the following code:
¤
¤ Dim myCat as New ADOX.Catalog
¤ Dim myCon as OleDb.OleDbConnection

Your Connection object is not properly defined:

Dim myCon as ADODB.Connection


Paul
~~~~
Microsoft MVP (Visual Basic)
 
M

Mary Chipman [MSFT]

If you're attempting to work with Access/Jet security, your best bet
is to use DAO through the office PIA. That being said, you do
understand that "Access security" is considered to be an oxymoron, no?
It's been compromised for years (a simple internet search will yield
thousands of results, including source code and services for cracking
it). Most developers consider it to be a waste of time because it does
nothing to protect sensitive data, which should *never* be stored in
Access. BTW, encryption in Access is only good for preventing the
database from being read by a text editor. Anyone who has a copy of
Access can open it.

--Mary
 
J

Jan Janssen

Hello Venkat_KL

Thanks for the quick response.

I want to share my application with other users who should be able to create
their own databases at demand. Since I'm not familiar with SQL servers, I'm
not sure it will work.
 
J

Jan Janssen

Thank you for the quick response, Mary.

Let me explain my intention.

I want to create a program in which users can store images along with other
information. The admin can create his databases on demand and specify his
own security measures. One of them is classifying an image. These
classifications can be used to autorisize other users (who have access to
the database) to view certain images (or not).

Since I don't want other users to mess around with these classifications, I
want to encrypt the database so they can't access it via other software.
They are forced to use my program which handles the rest of the security
measures.

PS: The admin can specify the location of theses images or even store them
inside the database (with or without removing the external images).

Jan Janssen
 
J

Jan Janssen

Hello Paul,

Thank you for your quick response. Although the bug has been fixed by using
an ADODB connection, the code still doesn't work.

myCat.Groups.Append("Test") returns the following error message:
"System.Runtime.InteropServices.COMException (0x800A0CB3): De gewenste
bewerking kan niet worden uitgevoerd."

Translated: Can't perform this action.

Oh well, back to the drawing board.

thanks anyway
 
P

Paul Clement

¤ Hello Paul,
¤
¤ Thank you for your quick response. Although the bug has been fixed by using
¤ an ADODB connection, the code still doesn't work.
¤
¤ myCat.Groups.Append("Test") returns the following error message:
¤ "System.Runtime.InteropServices.COMException (0x800A0CB3): De gewenste
¤ bewerking kan niet worden uitgevoerd."
¤
¤ Translated: Can't perform this action.
¤

I would recommend using Jet SQL if possible. This will eliminate the need for ADOX or DAO COM
interop.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnacc2k/html/acadvsql.asp


Paul
~~~~
Microsoft MVP (Visual Basic)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top