?
Solved

sql7 tables

Posted on 2001-08-30
3
Medium Priority
?
169 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
[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
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 200 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

800 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