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
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