Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Display Database table names in a combo box, using ADO objects

Posted on 1998-10-09
8
Medium Priority
?
179 Views
Last Modified: 2013-12-25
I am trying to add the names of tables located in a database to a combo box on my form. I need to use ADO objects. Any one can help?
I am using VB5 (Prof. & Enterprise version)

0
Comment
Question by:nazar66
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 4

Expert Comment

by:mcix
ID: 1496804
What is the back-end database?
0
 
LVL 14

Expert Comment

by:waty
ID: 1496805
  Dim nI   As Integer
   
   For nI = 1 To DB.TableDefs.Count
      cbCombo.Add DB.TableDefs(nI).Name
   Next

0
 

Author Comment

by:nazar66
ID: 1496806
Waty,

I don't have the object DB in ADODB (ADO).
I can't see any methods or objects named TableDef in ADODB.

I know that the stored procedure sp_tables will return the tables in a database but I couldn't execute this proceture using ADO objects.


mcix,

The database is SQL Server (OLE DB) using the ADO objects.




Regards,

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 4

Expert Comment

by:mcix
ID: 1496807
Did you get an error message or no results?
0
 
LVL 14

Expert Comment

by:waty
ID: 1496808
the solution was for DAO, so reject my answer.
0
 
LVL 2

Accepted Solution

by:
Veroland earned 400 total points
ID: 1496809
Use the following SQL statement , It worked for me:
"select name from sysobjects where type = 'U' order by name"

This brings the names of all the tables in the connected database
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1496810
   Dim nI As Integer
    For nI = 0 To Workspaces(0).Databases(0).TableDefs.Count - 1
        Combo1.AddItem Workspaces(0).Databases(0).TableDefs(nI).Name
    Next
0
 

Author Comment

by:nazar66
ID: 1496811
thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question