Solved

sql7 tables

Posted on 2001-08-30
3
163 Views
Last Modified: 2012-05-04
how to pupulate tables and fields in sql server 7 database using vb & ado.

thanks
0
Comment
Question by:ahm11
3 Comments
 

Expert Comment

by:pritam_dewan
ID: 6440005
I didnt understand ur question clearly.But if u want the field name of the tables then u can use the recordset object to get the feild name.If u want to populate the table name in the DB then pls reframe the question.
0
 
LVL 2

Accepted Solution

by:
RSivakumar_Sofil earned 50 total points
ID: 6440111
Try this.

Dim cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim rs1 As New ADODB.Recordset
Dim fld As ADODB.Field
Dim strTable As String
Dim strFields As String

cnn.Open "DSN=XXXXX;UID=YYYYY;pwd=ZZZZZZZ"
Set rs = cnn.OpenSchema(adSchemaTables, Array(Empty, Empty, Empty, "TABLE"))

    Do Until rs.EOF
        strTable = rs!TABLE_NAME
        Debug.Print strTable
       
        rs1.Open "select * from " & strTable, cnn
        Set Flds = rs1.Fields
        Dim TotalCount As Integer
        TotalCount = Flds.Count
        i = 0
        For Each fld In Flds
            strFields = strFields + fld.Name
            strFields = strFields + ","
        Next
        rs1.Close
        strFields = Left(strFields, Len(strFields) - 1)
        Debug.Print strFields
       
        rs.MoveNext
    Loop
     
    rs.Close
cnn.Close
0
 

Author Comment

by:ahm11
ID: 6443975
Just right thanks
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

706 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now