473,405 Members | 2,279 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Listing users of a database

I have used code from MS 198755 to create a module that lists current
users of the database. Works fine as long as db isnot password
potected. How do I adapt code to enter password?

This is code:

Sub ShowUserRosterMultipleUsers()
Dim cn As New ADODB.Connection
Dim cn2 As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim i, j As Long

cn.Provider = "Microsoft.Jet.OLEDB.4.0"
cn.Open "Data Source=c:\Northwind.mdb"

cn2.Open "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=c:\Northwind.mdb"

' The user roster is exposed as a provider-specific schema rowset
' in the Jet 4 OLE DB provider. You have to use a GUID to
' reference the schema, as provider-specific schemas are not
' listed in ADO's type library for schema rowsets

Set rs = cn.OpenSchema(adSchemaProviderSpecific, _
, "{947bb102-5d43-11d1-bdbf-00c04fb92675}")

'Output the list of all users in the current database.

Debug.Print rs.Fields(0).Name, "", rs.Fields(1).Name, _
"", rs.Fields(2).Name, rs.Fields(3).Name

While Not rs.EOF
Debug.Print rs.Fields(0), rs.Fields(1), _
rs.Fields(2), rs.Fields(3)
rs.MoveNext
Wend

End Sub

Many thanks for any help

Nov 13 '05 #1
4 2668
On 3 Nov 2005 13:10:18 -0800, "bill..AT..piperb.freeserve.co.uk"
<bi**@piperb.freeserve.co.uk> wrote:

You put the password as part of the connect string in the Open method.
See connectionstrings.com for examples for that.

-Tom.

I have used code from MS 198755 to create a module that lists current
users of the database. Works fine as long as db isnot password
potected. How do I adapt code to enter password?

This is code:

Sub ShowUserRosterMultipleUsers()
Dim cn As New ADODB.Connection
Dim cn2 As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim i, j As Long

cn.Provider = "Microsoft.Jet.OLEDB.4.0"
cn.Open "Data Source=c:\Northwind.mdb"

cn2.Open "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=c:\Northwind.mdb"

' The user roster is exposed as a provider-specific schema rowset
' in the Jet 4 OLE DB provider. You have to use a GUID to
' reference the schema, as provider-specific schemas are not
' listed in ADO's type library for schema rowsets

Set rs = cn.OpenSchema(adSchemaProviderSpecific, _
, "{947bb102-5d43-11d1-bdbf-00c04fb92675}")

'Output the list of all users in the current database.

Debug.Print rs.Fields(0).Name, "", rs.Fields(1).Name, _
"", rs.Fields(2).Name, rs.Fields(3).Name

While Not rs.EOF
Debug.Print rs.Fields(0), rs.Fields(1), _
rs.Fields(2), rs.Fields(3)
rs.MoveNext
Wend

End Sub

Many thanks for any help


Nov 13 '05 #2
Thanks Tom but sorry to be thick, I do not seem to be able to get it to
work.

Should I put
cn.Open "Data Source=c:\Northwind.mdb,,password"
or
cn.Open "Data Source=c:\Northwind.mdb"; ; "password"
or
cn.Open "Data Source=c:\Northwind.mdb"; ; pwd = "password"
or........
And do I need to put the same bit into the other data source line?

As you can tell I am far from expert!
Cheers for any help.
Bill
Tom van Stiphout wrote:
On 3 Nov 2005 13:10:18 -0800, "bill..AT..piperb.freeserve.co.uk"
<bi**@piperb.freeserve.co.uk> wrote:

You put the password as part of the connect string in the Open method.
See connectionstrings.com for examples for that.

-Tom.

I have used code from MS 198755 to create a module that lists current
users of the database. Works fine as long as db isnot password
potected. How do I adapt code to enter password?

This is code:

Sub ShowUserRosterMultipleUsers()
Dim cn As New ADODB.Connection
Dim cn2 As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim i, j As Long

cn.Provider = "Microsoft.Jet.OLEDB.4.0"
cn.Open "Data Source=c:\Northwind.mdb"

cn2.Open "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=c:\Northwind.mdb"

' The user roster is exposed as a provider-specific schema rowset
' in the Jet 4 OLE DB provider. You have to use a GUID to
' reference the schema, as provider-specific schemas are not
' listed in ADO's type library for schema rowsets

Set rs = cn.OpenSchema(adSchemaProviderSpecific, _
, "{947bb102-5d43-11d1-bdbf-00c04fb92675}")

'Output the list of all users in the current database.

Debug.Print rs.Fields(0).Name, "", rs.Fields(1).Name, _
"", rs.Fields(2).Name, rs.Fields(3).Name

While Not rs.EOF
Debug.Print rs.Fields(0), rs.Fields(1), _
rs.Fields(2), rs.Fields(3)
rs.MoveNext
Wend

End Sub

Many thanks for any help


Nov 13 '05 #3
On 4 Nov 2005 13:06:14 -0800, "bill..AT..piperb.freeserve.co.uk"
<bi**@piperb.freeserve.co.uk> wrote:

cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\Northwind.mdb;Jet OLEDB:Database
Password=SomeSecretPassword;"

In your code sample you are not using cn2. Comment out all lines with
cn2 and you'd still be OK.

-Tom.

Thanks Tom but sorry to be thick, I do not seem to be able to get it to
work.

Should I put
cn.Open "Data Source=c:\Northwind.mdb,,password"
or
cn.Open "Data Source=c:\Northwind.mdb"; ; "password"
or
cn.Open "Data Source=c:\Northwind.mdb"; ; pwd = "password"
or........
And do I need to put the same bit into the other data source line?

As you can tell I am far from expert!
Cheers for any help.
Bill
Tom van Stiphout wrote:
On 3 Nov 2005 13:10:18 -0800, "bill..AT..piperb.freeserve.co.uk"
<bi**@piperb.freeserve.co.uk> wrote:

You put the password as part of the connect string in the Open method.
See connectionstrings.com for examples for that.

-Tom.

>I have used code from MS 198755 to create a module that lists current
>users of the database. Works fine as long as db isnot password
>potected. How do I adapt code to enter password?
>
>This is code:
>
>Sub ShowUserRosterMultipleUsers()
> Dim cn As New ADODB.Connection
> Dim cn2 As New ADODB.Connection
> Dim rs As New ADODB.Recordset
> Dim i, j As Long
>
> cn.Provider = "Microsoft.Jet.OLEDB.4.0"
> cn.Open "Data Source=c:\Northwind.mdb"
>
> cn2.Open "Provider=Microsoft.Jet.OLEDB.4.0;" _
> & "Data Source=c:\Northwind.mdb"
>
> ' The user roster is exposed as a provider-specific schema rowset
> ' in the Jet 4 OLE DB provider. You have to use a GUID to
> ' reference the schema, as provider-specific schemas are not
> ' listed in ADO's type library for schema rowsets
>
> Set rs = cn.OpenSchema(adSchemaProviderSpecific, _
> , "{947bb102-5d43-11d1-bdbf-00c04fb92675}")
>
> 'Output the list of all users in the current database.
>
> Debug.Print rs.Fields(0).Name, "", rs.Fields(1).Name, _
> "", rs.Fields(2).Name, rs.Fields(3).Name
>
> While Not rs.EOF
> Debug.Print rs.Fields(0), rs.Fields(1), _
> rs.Fields(2), rs.Fields(3)
> rs.MoveNext
> Wend
>
>End Sub
>
>Many thanks for any help


Nov 13 '05 #4
Thanks Tom. I will give it a whirl!

Bill

Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Chris | last post by:
Hi, Not sure if this is the right forum, but hopefully someone can help me. I am creating something for our intranet and i want to list the files and folders of a directory, i found some code...
3
by: David Callaghan | last post by:
Hi I've just joined tesco broadband. I've come from NTL. If I don't put an index.htm on my NTL home page it justs lists the files in there when any browser visites my page. If I don't...
2
by: Somesh | last post by:
Hi, 1.I have installed and running a plone Intranet site, I have registerd users on it. I want to get list of all registerd users on a page. how I should move towards getting it / scripting it...
19
by: SU News Server | last post by:
I've struggled with this for quite a while and I'm am just not sure what is going on. I have the following code import os def buildList( directory='/Users/mkonrad' ) dirs = listing =...
1
by: Karen Hill | last post by:
I would like to be able to list all the users of a MS Access database in a combo box. How would one do this? What is the function or Sub look like to do something like this? I have ADO 3.6 I...
2
by: Tim_Mac | last post by:
this could be seen as petty... but i noticed if you browse a folder on a .net 2 virtual directory, you get the directory listing. but the font styles are set to 8 point verdana which is...
8
by: gil | last post by:
Is it possible to prevent a browser from listing the entire contents of a folder? The site, is hosted on my ISP with the following layout- site/ "user name from ISP" pagefile (dir)...
3
by: Seok Bee | last post by:
Hi All, Currently I have a storage server to allow users to store their files in a central location. In this server, there are many sub-folders for different departments. What I would like to...
3
by: =?Utf-8?B?ZG1idXNv?= | last post by:
I would like a listing of all users in the current domain (or on my computer). I'm running Windows XP Home Edition and I've set up four user, one for each member of my family. 'My.User.Name'...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.