Microsoft KB Archive/272268

= How To Manipulate the TRUSTEE PIN Jet Property with ADOX from an ASP Client =

Article ID: 272268

Article Last Modified on 7/1/2004

-

APPLIES TO


 * Microsoft Data Access Components 2.6

-



This article was previously published under Q272268



SUMMARY
This article demonstrates the use of Microsoft ActiveX Data Objects Extensions for Data Definition Language and Security (ADOX) to access different groups, properties, and the new TRUSTEE PIN property that is introduced in MDAC 2.6.



MORE INFORMATION
The following Active Server Pages (ASP) code uses a Microsoft Access 2000 database and performs various operations on the User and Group objects. The code requires that the database be joined to an Access workgroup (.mdw) file.

Create a file called &quot;Testadox.asp&quot; and add the following ASP code to the file: <%@ Language=VBScript %> <%

Dim adoConn        '   As ADODB.Connection Dim adoxCat        '   As adox.Catalog Dim adoxUsrs       '   As adox.Users Dim adoxGrps       '   As adox.Groups Set adoConn = Server.CreateObject(&quot;ADODB.Connection&quot;) ' Try this only against JOLT 4.0. ' Note the Jet OLEDB:System database property must be specified. adoConn.Open &quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=&quot; _ & &quot;c:\northwind.mdb;User Id=Admin;Password=thepassword;Jet OLEDB:System database=&quot; _ & &quot;c:\system1.mdw;&quot; Set adoxCat = Server.CreateObject(&quot;ADOX.Catalog&quot;) Set adoxCat.ActiveConnection = adoConn ' Displaying the Users Properties. Set adoxUsrs = adoxCat.Users DispUsers adoxUsrs ' Displaying the Groups Properties. Set adoxGrps = adoxCat.Groups DispGrps adoxGrps ' Adding a new user. AddUser adoxCat, &quot;User123&quot;, &quot;abcd123&quot; ' Displaying the User Properties. adoxUsrs.Refresh DispUsers adoxUsrs ' Deleting the User. adoxUsrs.Delete (&quot;User123&quot;) ' Displaying the User Properties. adoxUsrs.Refresh DispUsers adoxUsrs

Set adoxGrp = Nothing Set adoxGrps = Nothing Set adoxUsr = Nothing Set adoxUsrs = Nothing Set adoxCat.ActiveConnection = Nothing Set adoxCat = Nothing If adoConn.State = adStateOpen Then adoConn.Close End If   Set adoConn = Nothing Response.End Sub DispUsers(adoxUsrs) Dim adoxUsr 'As adox.User Dim prop   'As adox.Property Response.Write &quot; User Property Information &quot; Response.Write &quot;========================= &quot; For Each adoxUsr In adoxUsrs Response.Write&quot;User Name: &quot; & adoxUsr.Name & &quot; &quot; For Each prop In adoxUsr.Properties Response.Write prop.Name & &quot;: &quot; & prop.Value & &quot; &quot; Next Response.Write ( &quot; &quot;) Next End Sub

Sub DispGrps(adoxGrps) Dim adoxGrp    '   As adox.Group Dim prop       '   As adox.Property Response.Write &quot; Group Property Information &quot; Response.Write &quot;========================== &quot; For Each adoxGrp In adoxGrps Response.Write &quot;Group Name: &quot; & adoxGrp.Name & &quot; &quot; For Each prop In adoxGrp.Properties Response.Write prop.Name & &quot;: &quot; & prop.Value & &quot; &quot; Next Response.Write(&quot; &quot;) Next End Sub

Sub AddUser(adoxCat, usrName, usrPwd ) Dim adoxUsr    'As adox.User Set adoxUsr =  Server.CreateObject(&quot;adox.User&quot;) adoxUsr.ParentCatalog = adoxCat adoxUsr.Name = usrName adoxUsr.Properties(&quot;Jet OLEDB:Trustee Pin&quot;) = &quot;DonkeyKong&quot; adoxUsr.ChangePassword &quot;&quot;, usrPwd adoxCat.Users.Append adoxUsr End Sub

%>

Keywords: kbhowto KB272268

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.