How Can I List Tables in a DB?

  • Thread starter Thread starter Wayne Wengert
  • Start date Start date
W

Wayne Wengert

I am using VS.NET 2003, VB.NET, ADO.NET and an Access 2000 database. I want
to display a list of all tables in an Access database. I want to put that
list of table names in a listbox so the user can select the table they want
to use. How can I do this?
 
Good idea. I'll play with that

Wayne

Rick said:
You might want to look at the MSysObjects table. It is an access table that
lists all the objects for the database. I am pretty sure that the Type
column is 1 for table, and all the system tables are named "MSys*", so you
should be able to see all the tables that way.


having
 
¤ I am using VS.NET 2003, VB.NET, ADO.NET and an Access 2000 database. I want
¤ to display a list of all tables in an Access database. I want to put that
¤ list of table names in a listbox so the user can select the table they want
¤ to use. How can I do this?

Give the following a try:

Sub ListAccessTables()

Dim AccessConnection As System.Data.OleDb.OleDbConnection
Dim AccessDataTable As DataTable

Try

AccessConnection = New
System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=E:\My Documents\db1.mdb")

AccessConnection.Open()

AccessDataTable =
AccessConnection.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Tables, New Object()
{Nothing, Nothing, Nothing, "TABLE"})

DataGrid1.DataSource = AccessDataTable

Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
AccessConnection.Close()

End Try

End Sub


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
Hi Wayne,

To resolve this issue, we can perform the following steps:

1. Open the access database.
2. Click Tools on the menu and choose Options.
3. On the view tab, check Hidden objects and System objects. Click OK.
4. Click Tools on the menu and move to Security, choose User and Group
Permissions.
5. Select your user name and "MsysObjects" object name. Check "read data".

Then, the MsysObjects table can be accessed from code.

Does this answer your question? Please let me know if you need more
information

Best regards,
Lewis

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
| From: "Wayne Wengert" <[email protected]>
| References: <[email protected]>
| Subject: Permission Problem
| Date: Thu, 14 Aug 2003 08:10:01 -0600
| Lines: 148
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.general
| NNTP-Posting-Host: skybeam143.skybeam.frii.net 216.17.229.143
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:104555
| X-Tomcat-NG: microsoft.public.dotnet.general
|
| When I try to open the MSysObjects table I get the attached error. The
| Access DB is not password protected. How do I enable access to this table?
|
| Wayne
|
| | > I am using VS.NET 2003, VB.NET, ADO.NET and an Access 2000 database. I
| want
| > to display a list of all tables in an Access database. I want to put
that
| > list of table names in a listbox so the user can select the table they
| want
| > to use. How can I do this?
| >
| > --
| > ------------------------------------
| > Wayne Wengert
| > (e-mail address removed)
| >
| >
|
|
|
 
The table is created "on-the-fly" from my code. The user enters some data in
a particular situation and my code creates a new table. How can I set the
user permissions from code.

Also, I added "User ID = Admin" to the connection string and that does not
help. I tried experimenting with a table my program had created earlier and
Access will not let me assign Read rights to any user I create. The
MSysObjects table shows the owner as "Engine"

Wayne
 
Hi Wayne,

You may use SQL DDL to change permissions on the tables. Please check
following articles for more information:

Advanced Microsoft Jet SQL for Access 2000
http://msdn.microsoft.com/library/en-us/dnacc2k/html/acadvsql.asp

Intermediate Microsoft Jet SQL for Access 2000
http://msdn.microsoft.com/library/en-us/dnacc2k/html/acintsql.asp

Hope this is helpful.

Best regards,
Lewis

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: "Wayne Wengert" <[email protected]>
| References: <[email protected]>
<[email protected]>
<[email protected]>
| Subject: Re: Permission Problem
| Date: Thu, 14 Aug 2003 12:38:40 -0600
| Lines: 80
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.general
| NNTP-Posting-Host: skybeam143.skybeam.frii.net 216.17.229.143
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:104597
| X-Tomcat-NG: microsoft.public.dotnet.general
|
| The table is created "on-the-fly" from my code. The user enters some data
in
| a particular situation and my code creates a new table. How can I set the
| user permissions from code.
|
| Also, I added "User ID = Admin" to the connection string and that does not
| help. I tried experimenting with a table my program had created earlier
and
| Access will not let me assign Read rights to any user I create. The
| MSysObjects table shows the owner as "Engine"
|
| Wayne
|
| | > Hi Wayne,
| >
| > To resolve this issue, we can perform the following steps:
| >
| > 1. Open the access database.
| > 2. Click Tools on the menu and choose Options.
| > 3. On the view tab, check Hidden objects and System objects. Click OK.
| > 4. Click Tools on the menu and move to Security, choose User and Group
| > Permissions.
| > 5. Select your user name and "MsysObjects" object name. Check "read
data".
| >
| > Then, the MsysObjects table can be accessed from code.
| >
| > Does this answer your question? Please let me know if you need more
| > information
| >
| > Best regards,
| > Lewis
| >
| > This posting is provided "AS IS" with no warranties, and confers no
| rights.
| >
| > --------------------
| > | From: "Wayne Wengert" <[email protected]>
| > | References: <[email protected]>
| > | Subject: Permission Problem
| > | Date: Thu, 14 Aug 2003 08:10:01 -0600
| > | Lines: 148
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | Message-ID: <[email protected]>
| > | Newsgroups: microsoft.public.dotnet.general
| > | NNTP-Posting-Host: skybeam143.skybeam.frii.net 216.17.229.143
| > | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| > | Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:104555
| > | X-Tomcat-NG: microsoft.public.dotnet.general
| > |
| > | When I try to open the MSysObjects table I get the attached error. The
| > | Access DB is not password protected. How do I enable access to this
| table?
| > |
| > | Wayne
| > |
| > | | > | > I am using VS.NET 2003, VB.NET, ADO.NET and an Access 2000
database. I
| > | want
| > | > to display a list of all tables in an Access database. I want to put
| > that
| > | > list of table names in a listbox so the user can select the table
they
| > | want
| > | > to use. How can I do this?
| > | >
| > | > --
| > | > ------------------------------------
| > | > Wayne Wengert
| > | > (e-mail address removed)
| > | >
| > | >
| > |
| > |
| > |
| >
|
|
|
 
Hi Wayne,

You may set "impersonate" to "true" in web.config, then the ASP.NET
application will have the permission to access the Hidden Objects in Access.

The following is a code snippet for a demonstration.
<identity impersonate="true"></identity>

INFO: Implementing Impersonation in an ASP.NET Application.
<http://support.microsoft.com/?id=306158>

INFO: ASP.NET Security Overview
<http://support.microsoft.com/default.aspx?id=306590>

Does this answer your question? Please let me know if you need more
information.

Best regards,
Lewis

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
| From: "Wayne Wengert" <[email protected]>
| References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| Subject: Re: Permission Problem
| Date: Fri, 15 Aug 2003 17:20:13 -0600
| Lines: 437
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.general
| NNTP-Posting-Host: skybeam143.skybeam.frii.net 216.17.229.143
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:104734
| X-Tomcat-NG: microsoft.public.dotnet.general
|
| Lewis;
|
| I tried using the samples in the referenced articles using this code:
|
| strSQL = "GRANT SELECT ON TABLE MSysObjects TO Admin"
|
| myConn.Execute(strSQL)
|
|
| But I get the attached error. I am not sure how to resolve this? I did add
| the Imports for Interop thinking that might help - it didn't.
|
| Wayne
|
| | > Hi Wayne,
| >
| > You may use SQL DDL to change permissions on the tables. Please check
| > following articles for more information:
| >
| > Advanced Microsoft Jet SQL for Access 2000
| > http://msdn.microsoft.com/library/en-us/dnacc2k/html/acadvsql.asp
| >
| > Intermediate Microsoft Jet SQL for Access 2000
| > http://msdn.microsoft.com/library/en-us/dnacc2k/html/acintsql.asp
| >
| > Hope this is helpful.
| >
| > Best regards,
| > Lewis
| >
| > This posting is provided "AS IS" with no warranties, and confers no
| rights.
| > --------------------
| > | From: "Wayne Wengert" <[email protected]>
| > | References: <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > | Subject: Re: Permission Problem
| > | Date: Thu, 14 Aug 2003 12:38:40 -0600
| > | Lines: 80
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | Message-ID: <[email protected]>
| > | Newsgroups: microsoft.public.dotnet.general
| > | NNTP-Posting-Host: skybeam143.skybeam.frii.net 216.17.229.143
| > | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| > | Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:104597
| > | X-Tomcat-NG: microsoft.public.dotnet.general
| > |
| > | The table is created "on-the-fly" from my code. The user enters some
| data
| > in
| > | a particular situation and my code creates a new table. How can I set
| the
| > | user permissions from code.
| > |
| > | Also, I added "User ID = Admin" to the connection string and that does
| not
| > | help. I tried experimenting with a table my program had created
earlier
| > and
| > | Access will not let me assign Read rights to any user I create. The
| > | MSysObjects table shows the owner as "Engine"
| > |
| > | Wayne
| > |
| > | | > | > Hi Wayne,
| > | >
| > | > To resolve this issue, we can perform the following steps:
| > | >
| > | > 1. Open the access database.
| > | > 2. Click Tools on the menu and choose Options.
| > | > 3. On the view tab, check Hidden objects and System objects. Click
OK.
| > | > 4. Click Tools on the menu and move to Security, choose User and
Group
| > | > Permissions.
| > | > 5. Select your user name and "MsysObjects" object name. Check "read
| > data".
| > | >
| > | > Then, the MsysObjects table can be accessed from code.
| > | >
| > | > Does this answer your question? Please let me know if you need more
| > | > information
| > | >
| > | > Best regards,
| > | > Lewis
| > | >
| > | > This posting is provided "AS IS" with no warranties, and confers no
| > | rights.
| > | >
| > | > --------------------
| > | > | From: "Wayne Wengert" <[email protected]>
| > | > | References: <[email protected]>
| > | > | Subject: Permission Problem
| > | > | Date: Thu, 14 Aug 2003 08:10:01 -0600
| > | > | Lines: 148
| > | > | X-Priority: 3
| > | > | X-MSMail-Priority: Normal
| > | > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | > | Message-ID: <[email protected]>
| > | > | Newsgroups: microsoft.public.dotnet.general
| > | > | NNTP-Posting-Host: skybeam143.skybeam.frii.net 216.17.229.143
| > | > | Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| > | > | Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:104555
| > | > | X-Tomcat-NG: microsoft.public.dotnet.general
| > | > |
| > | > | When I try to open the MSysObjects table I get the attached error.
| The
| > | > | Access DB is not password protected. How do I enable access to
this
| > | table?
| > | > |
| > | > | Wayne
| > | > |
| > | > | | > | > | > I am using VS.NET 2003, VB.NET, ADO.NET and an Access 2000
| > database. I
| > | > | want
| > | > | > to display a list of all tables in an Access database. I want to
| put
| > | > that
| > | > | > list of table names in a listbox so the user can select the
table
| > they
| > | > | want
| > | > | > to use. How can I do this?
| > | > | >
| > | > | > --
| > | > | > ------------------------------------
| > | > | > Wayne Wengert
| > | > | > (e-mail address removed)
| > | > | >
| > | > | >
| > | > |
| > | > |
| > | > |
| > | >
| > |
| > |
| > |
| >
|
|
|
 
Hi Wayne,

Sorry for my misunderstanding.

I am checking this issue, and will get back to you with my findings.

Best regards,
Lewis

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
| From: "Wayne Wengert" <[email protected]>
| References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| Subject: Re: Permission Problem
| Date: Mon, 18 Aug 2003 03:56:53 -0600
| Lines: 217
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.general
| NNTP-Posting-Host: skybeam143.skybeam.frii.net 216.17.229.143
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:104867
| X-Tomcat-NG: microsoft.public.dotnet.general
|
| This is a Windows application - will that technique still work?
|
| Wayne
|
| | > Hi Wayne,
| >
| > You may set "impersonate" to "true" in web.config, then the ASP.NET
| > application will have the permission to access the Hidden Objects in
| Access.
| >
| > The following is a code snippet for a demonstration.
| > <identity impersonate="true"></identity>
| >
| > INFO: Implementing Impersonation in an ASP.NET Application.
| > <http://support.microsoft.com/?id=306158>
| >
| > INFO: ASP.NET Security Overview
| > <http://support.microsoft.com/default.aspx?id=306590>
| >
| > Does this answer your question? Please let me know if you need more
| > information.
| >
| > Best regards,
| > Lewis
| >
| > This posting is provided "AS IS" with no warranties, and confers no
| rights.
| >
| > --------------------
| > | From: "Wayne Wengert" <[email protected]>
| > | References: <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > | Subject: Re: Permission Problem
| > | Date: Fri, 15 Aug 2003 17:20:13 -0600
| > | Lines: 437
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | Message-ID: <[email protected]>
| > | Newsgroups: microsoft.public.dotnet.general
| > | NNTP-Posting-Host: skybeam143.skybeam.frii.net 216.17.229.143
| > | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| > | Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:104734
| > | X-Tomcat-NG: microsoft.public.dotnet.general
| > |
| > | Lewis;
| > |
| > | I tried using the samples in the referenced articles using this code:
| > |
| > | strSQL = "GRANT SELECT ON TABLE MSysObjects TO Admin"
| > |
| > | myConn.Execute(strSQL)
| > |
| > |
| > | But I get the attached error. I am not sure how to resolve this? I did
| add
| > | the Imports for Interop thinking that might help - it didn't.
| > |
| > | Wayne
| > |
| > | | > | > Hi Wayne,
| > | >
| > | > You may use SQL DDL to change permissions on the tables. Please
check
| > | > following articles for more information:
| > | >
| > | > Advanced Microsoft Jet SQL for Access 2000
| > | > http://msdn.microsoft.com/library/en-us/dnacc2k/html/acadvsql.asp
| > | >
| > | > Intermediate Microsoft Jet SQL for Access 2000
| > | > http://msdn.microsoft.com/library/en-us/dnacc2k/html/acintsql.asp
| > | >
| > | > Hope this is helpful.
| > | >
| > | > Best regards,
| > | > Lewis
| > | >
| > | > This posting is provided "AS IS" with no warranties, and confers no
| > | rights.
| > | > --------------------
| > | > | From: "Wayne Wengert" <[email protected]>
| > | > | References: <[email protected]>
| > | > <[email protected]>
| > | > <[email protected]>
| > | > | Subject: Re: Permission Problem
| > | > | Date: Thu, 14 Aug 2003 12:38:40 -0600
| > | > | Lines: 80
| > | > | X-Priority: 3
| > | > | X-MSMail-Priority: Normal
| > | > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | > | Message-ID: <[email protected]>
| > | > | Newsgroups: microsoft.public.dotnet.general
| > | > | NNTP-Posting-Host: skybeam143.skybeam.frii.net 216.17.229.143
| > | > | Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| > | > | Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:104597
| > | > | X-Tomcat-NG: microsoft.public.dotnet.general
| > | > |
| > | > | The table is created "on-the-fly" from my code. The user enters
some
| > | data
| > | > in
| > | > | a particular situation and my code creates a new table. How can I
| set
| > | the
| > | > | user permissions from code.
| > | > |
| > | > | Also, I added "User ID = Admin" to the connection string and that
| does
| > | not
| > | > | help. I tried experimenting with a table my program had created
| > earlier
| > | > and
| > | > | Access will not let me assign Read rights to any user I create.
The
| > | > | MSysObjects table shows the owner as "Engine"
| > | > |
| > | > | Wayne
| > | > |
message
| > | > | | > | > | > Hi Wayne,
| > | > | >
| > | > | > To resolve this issue, we can perform the following steps:
| > | > | >
| > | > | > 1. Open the access database.
| > | > | > 2. Click Tools on the menu and choose Options.
| > | > | > 3. On the view tab, check Hidden objects and System objects.
Click
| > OK.
| > | > | > 4. Click Tools on the menu and move to Security, choose User and
| > Group
| > | > | > Permissions.
| > | > | > 5. Select your user name and "MsysObjects" object name. Check
| "read
| > | > data".
| > | > | >
| > | > | > Then, the MsysObjects table can be accessed from code.
| > | > | >
| > | > | > Does this answer your question? Please let me know if you need
| more
| > | > | > information
| > | > | >
| > | > | > Best regards,
| > | > | > Lewis
| > | > | >
| > | > | > This posting is provided "AS IS" with no warranties, and confers
| no
| > | > | rights.
| > | > | >
| > | > | > --------------------
| > | > | > | From: "Wayne Wengert" <[email protected]>
| > | > | > | References: <[email protected]>
| > | > | > | Subject: Permission Problem
| > | > | > | Date: Thu, 14 Aug 2003 08:10:01 -0600
| > | > | > | Lines: 148
| > | > | > | X-Priority: 3
| > | > | > | X-MSMail-Priority: Normal
| > | > | > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | > | > | Message-ID: <[email protected]>
| > | > | > | Newsgroups: microsoft.public.dotnet.general
| > | > | > | NNTP-Posting-Host: skybeam143.skybeam.frii.net 216.17.229.143
| > | > | > | Path:
| > cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| > | > | > | Xref: cpmsftngxa06.phx.gbl
| microsoft.public.dotnet.general:104555
| > | > | > | X-Tomcat-NG: microsoft.public.dotnet.general
| > | > | > |
| > | > | > | When I try to open the MSysObjects table I get the attached
| error.
| > | The
| > | > | > | Access DB is not password protected. How do I enable access to
| > this
| > | > | table?
| > | > | > |
| > | > | > | Wayne
| > | > | > |
| > | > | > | | > | > | > | > I am using VS.NET 2003, VB.NET, ADO.NET and an Access 2000
| > | > database. I
| > | > | > | want
| > | > | > | > to display a list of all tables in an Access database. I
want
| to
| > | put
| > | > | > that
| > | > | > | > list of table names in a listbox so the user can select the
| > table
| > | > they
| > | > | > | want
| > | > | > | > to use. How can I do this?
| > | > | > | >
| > | > | > | > --
| > | > | > | > ------------------------------------
| > | > | > | > Wayne Wengert
| > | > | > | > (e-mail address removed)
| > | > | > | >
| > | > | > | >
| > | > | > |
| > | > | > |
| > | > | > |
| > | > | >
| > | > |
| > | > |
| > | > |
| > | >
| > |
| > |
| > |
| >
|
|
|
 
Hi Wayne,

To resolve this problem, you may perform the following steps.

1. Create "Secured.mdw" using "Wrkgadm.exe" for the access database. This
"Wrkgadm.exe" can be found at the following location: "C:\Program
Files\Microsoft Office\Office\1033". The following KB article described how
to create "Secured.mdw" using "Wrkgadm.exe".

305541 ACC2000: Understanding the Role of Workgroup Information Files in
Access
http://support.microsoft.com/?id=305541


2. Use MSDataShape Provider to grant privilege to Admin. The following is a
code snippet for demonstration, you can modify it to meet your reference.

oleDbConnection1=new OleDbConnection(@"Provider=MSDataShape;Data
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db1.mdb;User
Id=admin;Password=;Jet OLEDB:System Database=Secured.mdw");
oleDbConnection1.Open ();
oleDbCommand1=new OleDbCommand ("GRANT SELECT ON TABLE MSysObjects TO
Admin",oleDbConnection1);
oleDbCommand1.ExecuteNonQuery();
oleDbDataAdapter1=new OleDbDataAdapter("SELECT * FROM
MSysObjects",oleDbConnection1);
DataSet ds=new DataSet();
oleDbDataAdapter1.Fill(ds);

For more information, you may check the KB article:

247662 HOWTO: Access a Secured Jet Database Through the MSDataShape Provider
http://support.microsoft.com/?id=247662

Best regards,
Lewis

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
| From: "Wayne Wengert" <[email protected]>
| References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| Subject: Re: Permission Problem
| Date: Mon, 18 Aug 2003 03:56:53 -0600
| Lines: 217
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.general
| NNTP-Posting-Host: skybeam143.skybeam.frii.net 216.17.229.143
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:104867
| X-Tomcat-NG: microsoft.public.dotnet.general
|
| This is a Windows application - will that technique still work?
|
| Wayne
|
| | > Hi Wayne,
| >
| > You may set "impersonate" to "true" in web.config, then the ASP.NET
| > application will have the permission to access the Hidden Objects in
| Access.
| >
| > The following is a code snippet for a demonstration.
| > <identity impersonate="true"></identity>
| >
| > INFO: Implementing Impersonation in an ASP.NET Application.
| > <http://support.microsoft.com/?id=306158>
| >
| > INFO: ASP.NET Security Overview
| > <http://support.microsoft.com/default.aspx?id=306590>
| >
| > Does this answer your question? Please let me know if you need more
| > information.
| >
| > Best regards,
| > Lewis
| >
| > This posting is provided "AS IS" with no warranties, and confers no
| rights.
| >
| > --------------------
| > | From: "Wayne Wengert" <[email protected]>
| > | References: <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > | Subject: Re: Permission Problem
| > | Date: Fri, 15 Aug 2003 17:20:13 -0600
| > | Lines: 437
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | Message-ID: <[email protected]>
| > | Newsgroups: microsoft.public.dotnet.general
| > | NNTP-Posting-Host: skybeam143.skybeam.frii.net 216.17.229.143
| > | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| > | Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:104734
| > | X-Tomcat-NG: microsoft.public.dotnet.general
| > |
| > | Lewis;
| > |
| > | I tried using the samples in the referenced articles using this code:
| > |
| > | strSQL = "GRANT SELECT ON TABLE MSysObjects TO Admin"
| > |
| > | myConn.Execute(strSQL)
| > |
| > |
| > | But I get the attached error. I am not sure how to resolve this? I did
| add
| > | the Imports for Interop thinking that might help - it didn't.
| > |
| > | Wayne
| > |
| > | | > | > Hi Wayne,
| > | >
| > | > You may use SQL DDL to change permissions on the tables. Please
check
| > | > following articles for more information:
| > | >
| > | > Advanced Microsoft Jet SQL for Access 2000
| > | > http://msdn.microsoft.com/library/en-us/dnacc2k/html/acadvsql.asp
| > | >
| > | > Intermediate Microsoft Jet SQL for Access 2000
| > | > http://msdn.microsoft.com/library/en-us/dnacc2k/html/acintsql.asp
| > | >
| > | > Hope this is helpful.
| > | >
| > | > Best regards,
| > | > Lewis
| > | >
| > | > This posting is provided "AS IS" with no warranties, and confers no
| > | rights.
| > | > --------------------
| > | > | From: "Wayne Wengert" <[email protected]>
| > | > | References: <[email protected]>
| > | > <[email protected]>
| > | > <[email protected]>
| > | > | Subject: Re: Permission Problem
| > | > | Date: Thu, 14 Aug 2003 12:38:40 -0600
| > | > | Lines: 80
| > | > | X-Priority: 3
| > | > | X-MSMail-Priority: Normal
| > | > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | > | Message-ID: <[email protected]>
| > | > | Newsgroups: microsoft.public.dotnet.general
| > | > | NNTP-Posting-Host: skybeam143.skybeam.frii.net 216.17.229.143
| > | > | Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| > | > | Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:104597
| > | > | X-Tomcat-NG: microsoft.public.dotnet.general
| > | > |
| > | > | The table is created "on-the-fly" from my code. The user enters
some
| > | data
| > | > in
| > | > | a particular situation and my code creates a new table. How can I
| set
| > | the
| > | > | user permissions from code.
| > | > |
| > | > | Also, I added "User ID = Admin" to the connection string and that
| does
| > | not
| > | > | help. I tried experimenting with a table my program had created
| > earlier
| > | > and
| > | > | Access will not let me assign Read rights to any user I create.
The
| > | > | MSysObjects table shows the owner as "Engine"
| > | > |
| > | > | Wayne
| > | > |
message
| > | > | | > | > | > Hi Wayne,
| > | > | >
| > | > | > To resolve this issue, we can perform the following steps:
| > | > | >
| > | > | > 1. Open the access database.
| > | > | > 2. Click Tools on the menu and choose Options.
| > | > | > 3. On the view tab, check Hidden objects and System objects.
Click
| > OK.
| > | > | > 4. Click Tools on the menu and move to Security, choose User and
| > Group
| > | > | > Permissions.
| > | > | > 5. Select your user name and "MsysObjects" object name. Check
| "read
| > | > data".
| > | > | >
| > | > | > Then, the MsysObjects table can be accessed from code.
| > | > | >
| > | > | > Does this answer your question? Please let me know if you need
| more
| > | > | > information
| > | > | >
| > | > | > Best regards,
| > | > | > Lewis
| > | > | >
| > | > | > This posting is provided "AS IS" with no warranties, and confers
| no
| > | > | rights.
| > | > | >
| > | > | > --------------------
| > | > | > | From: "Wayne Wengert" <[email protected]>
| > | > | > | References: <[email protected]>
| > | > | > | Subject: Permission Problem
| > | > | > | Date: Thu, 14 Aug 2003 08:10:01 -0600
| > | > | > | Lines: 148
| > | > | > | X-Priority: 3
| > | > | > | X-MSMail-Priority: Normal
| > | > | > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | > | > | Message-ID: <[email protected]>
| > | > | > | Newsgroups: microsoft.public.dotnet.general
| > | > | > | NNTP-Posting-Host: skybeam143.skybeam.frii.net 216.17.229.143
| > | > | > | Path:
| > cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| > | > | > | Xref: cpmsftngxa06.phx.gbl
| microsoft.public.dotnet.general:104555
| > | > | > | X-Tomcat-NG: microsoft.public.dotnet.general
| > | > | > |
| > | > | > | When I try to open the MSysObjects table I get the attached
| error.
| > | The
| > | > | > | Access DB is not password protected. How do I enable access to
| > this
| > | > | table?
| > | > | > |
| > | > | > | Wayne
| > | > | > |
| > | > | > | | > | > | > | > I am using VS.NET 2003, VB.NET, ADO.NET and an Access 2000
| > | > database. I
| > | > | > | want
| > | > | > | > to display a list of all tables in an Access database. I
want
| to
| > | put
| > | > | > that
| > | > | > | > list of table names in a listbox so the user can select the
| > table
| > | > they
| > | > | > | want
| > | > | > | > to use. How can I do this?
| > | > | > | >
| > | > | > | > --
| > | > | > | > ------------------------------------
| > | > | > | > Wayne Wengert
| > | > | > | > (e-mail address removed)
| > | > | > | >
| > | > | > | >
| > | > | > |
| > | > | > |
| > | > | > |
| > | > | >
| > | > |
| > | > |
| > | > |
| > | >
| > |
| > |
| > |
| >
|
|
|
 
Back
Top