473,473 Members | 2,060 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Get table names from MSAccess Datasource

Hello all,

I have a vb6 (not .NET) program using MS Access as the backend. As part of
an import form, I need to allow the user to select the table containing the
data to be imported. How can I populate a combo with this information?
Then, once this value is selected, how can I populate other combos with the
column names of the selected table?
Thanks,

Steven Smith

Apr 17 '06 #1
6 2445
Hi,

Maybe this will help.

http://www.vb-tips.com/default.aspx?...c-e9d7983c1e05

Ken
----------------
"Steven Smith" <sl****@webbox.com> wrote in message
news:73**************@twister.nyroc.rr.com...
Hello all,

I have a vb6 (not .NET) program using MS Access as the backend. As part of
an import form, I need to allow the user to select the table containing
the
data to be imported. How can I populate a combo with this information?
Then, once this value is selected, how can I populate other combos with
the
column names of the selected table?
Thanks,

Steven Smith

Apr 18 '06 #2
Thanks Ken... it wasn't quite what I needed, but it pointed me in the right
direction.

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in
news:eZ**************@TK2MSFTNGP05.phx.gbl:
Hi,

Maybe this will help.

http://www.vb-tips.com/default.aspx?...-8c6c-e9d7983c
1e05

Ken
----------------
"Steven Smith" <sl****@webbox.com> wrote in message
news:73**************@twister.nyroc.rr.com...
Hello all,

I have a vb6 (not .NET) program using MS Access as the backend. As
part of an import form, I need to allow the user to select the table
containing the
data to be imported. How can I populate a combo with this
information? Then, once this value is selected, how can I populate
other combos with the
column names of the selected table?
Thanks,

Steven Smith



Apr 18 '06 #3
Steven,

Somebody else was asking the same question, maybe we should extend our
sample with the schema information.

http://msdn2.microsoft.com/en-us/lib...fh(VS.80).aspx

But using that sample the schema option easy to find and it works the same..

I hope this helps,

Cor

"Steven Smith" <sl****@webbox.com> schreef in bericht
news:_v****************@twister.nyroc.rr.com...
Thanks Ken... it wasn't quite what I needed, but it pointed me in the
right
direction.

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in
news:eZ**************@TK2MSFTNGP05.phx.gbl:
Hi,

Maybe this will help.

http://www.vb-tips.com/default.aspx?...-8c6c-e9d7983c
1e05

Ken
----------------
"Steven Smith" <sl****@webbox.com> wrote in message
news:73**************@twister.nyroc.rr.com...
Hello all,

I have a vb6 (not .NET) program using MS Access as the backend. As
part of an import form, I need to allow the user to select the table
containing the
data to be imported. How can I populate a combo with this
information? Then, once this value is selected, how can I populate
other combos with the
column names of the selected table?
Thanks,

Steven Smith


Apr 18 '06 #4
>
Somebody else was asking the same question, maybe we should extend our
sample with the schema information.

I forgot to type it complete, therefore the link was still in my clipboard.
Apr 18 '06 #5
On Mon, 17 Apr 2006 20:40:35 GMT, Steven Smith <sl****@webbox.com> wrote:

¤ Hello all,
¤
¤ I have a vb6 (not .NET) program using MS Access as the backend. As part of
¤ an import form, I need to allow the user to select the table containing the
¤ data to be imported. How can I populate a combo with this information?
¤ Then, once this value is selected, how can I populate other combos with the
¤ column names of the selected table?
¤

List of Tables:

Dim DatabaseConnection As New System.Data.OleDb.OleDbConnection
Dim SchemaTable As DataTable

DatabaseConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Test Files\db1 XP.mdb"

DatabaseConnection.Open()

SchemaTable =
DatabaseConnection.GetOleDbSchemaTable(System.Data .OleDb.OleDbSchemaGuid.Tables, _
New Object() {Nothing, Nothing, Nothing,
Nothing})

Dim RowCount As Int32
For RowCount = 0 To SchemaTable.Rows.Count - 1
TableListCombo.Items.Add(SchemaTable.Rows(RowCount )!TABLE_NAME.ToString)
Next RowCount

DatabaseConnection.Close()

List of Columns:

Dim DatabaseConnection As New System.Data.OleDb.OleDbConnection
Dim SchemaTable As DataTable

DatabaseConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Test Files\db1 XP.mdb"

DatabaseConnection.Open()

SchemaTable =
DatabaseConnection.GetOleDbSchemaTable(System.Data .OleDb.OleDbSchemaGuid.Columns, _
New Object() {Nothing, Nothing, "Table1"})

Dim RowCount As Int32
For RowCount = 0 To SchemaTable.Rows.Count - 1
ColumnListCombo.Items.Add(SchemaTable.Rows(RowCoun t)!COLUMN_NAME.ToString)
Next RowCount

DatabaseConnection.Close()
Paul
~~~~
Microsoft MVP (Visual Basic)
Apr 18 '06 #6
Thanks!
Paul Clement <Us***********************@swspectrum.com> wrote in
news:af********************************@4ax.com:
On Mon, 17 Apr 2006 20:40:35 GMT, Steven Smith <sl****@webbox.com>
wrote:

¤ Hello all,
¤
¤ I have a vb6 (not .NET) program using MS Access as the backend. As
part of ¤ an import form, I need to allow the user to select the table
containing the ¤ data to be imported. How can I populate a combo with
this information? ¤ Then, once this value is selected, how can I
populate other combos with the ¤ column names of the selected table?
¤

List of Tables:

Dim DatabaseConnection As New
System.Data.OleDb.OleDbConnection Dim SchemaTable As DataTable

DatabaseConnection.ConnectionString =
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Test Files\db1 XP.mdb"

DatabaseConnection.Open()

SchemaTable =
DatabaseConnection.GetOleDbSchemaTable(System.Data .OleDb.OleDbSchemaGui
d.Tables, _
New
Object() {Nothing, Nothing, Nothing,
Nothing})

Dim RowCount As Int32
For RowCount = 0 To SchemaTable.Rows.Count - 1
TableListCombo.Items.Add(SchemaTable.Rows(RowCount )!TABLE_N
AME.ToString)
Next RowCount

DatabaseConnection.Close()

List of Columns:

Dim DatabaseConnection As New
System.Data.OleDb.OleDbConnection Dim SchemaTable As DataTable

DatabaseConnection.ConnectionString =
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Test Files\db1 XP.mdb"

DatabaseConnection.Open()

SchemaTable =
DatabaseConnection.GetOleDbSchemaTable(System.Data .OleDb.OleDbSchemaGui
d.Columns, _
New Object() {Nothing, Nothing, "Table1"})

Dim RowCount As Int32
For RowCount = 0 To SchemaTable.Rows.Count - 1
ColumnListCombo.Items.Add(SchemaTable.Rows(RowCoun t)!COLUMN
_NAME.ToString)
Next RowCount

DatabaseConnection.Close()
Paul
~~~~
Microsoft MVP (Visual Basic)


Apr 18 '06 #7

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

Similar topics

1
by: X | last post by:
Howdy: To follow up on a problem with MS Access (2000) and Oracle 9i (9.2.0.x) - History: I am trying to import tables from my Oracle 9i database on RedHat Linux 7.2 to MS Access (2000) on...
0
by: Paul | last post by:
Hi I have a problem with the DataGrid Datasource. The issue is this, setting the grid DataSource to Table1, which is done when the page loads and then changing the datasource to a different...
22
by: EMW | last post by:
Hi, I managed to create a SQL server database and a table in it. The table is empty and that brings me to my next chalenge: How can I get the info in the table in the dataset to go in an empty...
4
by: Mel | last post by:
Hi, I created a form that would search a record from a table and showed the details in datagrid. I have another button that would insert the records showed in the datagrid to another table..How...
4
by: robboll | last post by:
Please excuse my ignorance, but I am trying to teach myself .Net without a lot of help. At this point I have created a page with a few text boxes and combo boxes that I am using as an example. ...
11
by: Kay | last post by:
Hi all, I have populated a dataset with several tables, say - Roster, Agent and few more . The dataset is used to populated a listview with some shift info.. I think I'm sucessfully created a...
4
by: Steven Smith | last post by:
Hello all, I have a vb6 (not .NET) program using MS Access as the backend. As part of an import form, I need to allow the user to select the table containing the data to be imported. How can I...
4
by: Gregory Gadow | last post by:
If there is a more appropriate forum, please let me know and I will post there. Our field reps can go on to our website and select from several sets of data to create the address we then provide...
3
by: zufie | last post by:
I want to use SQL code to Create a Table & Provide a Default Value for Each Column. Here is the code I am using: CREATE TABLE customer (First_Name char(50), Last_Name char(50), Address...
3
by: Icemokka | last post by:
Hi, I've got a table in MsAccess with 100+ fields. If I fill a tabletable with this table , change some values , get the update-command via commandbuilder , the update fails. This because the...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.