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

x
?
Solved

sql7 tables

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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 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…
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