Solved

sql7 tables

Posted on 2001-08-30
3
164 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

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB 6.0 printer how to align 6 62
Run code from text file in vb 1 64
How to set the row selection as it was prior leaving the datagrid in vb6 3 42
Child Form in front 4 47
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

772 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