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
[321 byte] By [
him_mca] at [2007-11-11 10:13:09]

# 2 Re: ascii text file
try this...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