DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: ascii text file

  1. #1
    Join Date
    Jan 2007
    Posts
    6

    ascii text file

    i have a database table in the sqlserver 2000 having fields are

    name,age,dob,phone

    and this data is storing into the table called personal

    now i would like to extract this information form personal table to a ascii text file
    so how can i do this, plz help me and provide a code for the same

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Dec 2006
    Location
    Chennai, India
    Posts
    8
    try this...
    Code:
    Private Sub Command1_Click()
        Dim i As Integer, j As Integer
        Dim rsEmployee As ADODB.Recordset
        Dim iFreeFile As Integer
    
        Set rsEmployee = New ADODB.Recordset
    
        Sql = "Select * From Tbl_Employee"
        rsEmployee.Open Sql, Cn, adOpenKeyset, adLockOptimistic
    
        iFreeFile = FreeFile()
        Open "E:\MC\NewFile.Txt" For Output As #iFreeFile
    
        For i = 0 To rsEmployee.Fields.Count - 1
            Print #iFreeFile, rsEmployee.Fields(i).Name & ",";
        Next
        Print #iFreeFile, ""
        
        For i = 0 To rsEmployee.RecordCount - 1
            For j = 0 To rsEmployee.Fields.Count - 1
                Print #iFreeFile, rsEmployee.Fields(j).Value & ",";
            Next
            Print #iFreeFile, ""
            rsEmployee.MoveNext
        Next
        Close iFreeFile
    
        rsEmployee.Close
        Set rsEmployee = Nothing
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center