Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help me...it's horrible

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I would like to know how can I convert the database to text file? it is sound like easy but i'm stuck. please.
 
If you want to do it in VB, create a recordset and use the following SQL
SELECT * FROM

then loop through

rs.movefirst
while not rs.eof
output_line=""
for x=0 to RS.item.count-1
output_line=output_line & chr(34) & rs.item(x).value & iif(x<>rs.item.count-1,chr(34),&quot;&quot;)
next x
print #ofile, output_line
wend

do this for each table in dB

rgds
Mike
email me offline if you want further help
michael.toye@bmw.co.uk
 
oops! the line in the for loop should be
output_line=output_line & chr(34) & rs.item(x).value & chr(34) & iif(x<>rs.item.count-1,&quot;,&quot;,&quot;&quot;)

der!
Mike
 
don't forget the rs.movenext either.


It's 7:50 in the morning - I do apologise!!!!
 
Here's a fast and simple way.

ADO recordsets support a GetString method which converts the entire recordset to a string. It's very fast and clean.

rsTmp is an ADO recordset populated with some data...


Open &quot;c:\temp\export.txt&quot; For Output As #1

Print #1, rsTmp.GetString

Close #1



John Curran
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top