Solved

sql7 tables

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

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 …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

733 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