dBASE Programming - Writing to a .txt file directly

This is Interesting: Free IT Magazines  
Home > Archive > dBASE Programming > March 2005 > Writing to a .txt file directly





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Writing to a .txt file directly
J. Trouwborst

2005-03-28, 6:10 pm

Hello,

I made some application in Dbase. Now I want to write to a .txt file
directly in an application from a .dbf file.
I know it is possible with Dquery to convert a file to a .txt file, but I
want to build it in in a .wfm file or program.
How can I do this.
Please some help in this

J. Trouwborst


Michael Nuwer [dBVIPS]

2005-03-28, 6:10 pm

J. Trouwborst wrote:
> Hello,
>
> I made some application in Dbase. Now I want to write to a .txt file
> directly in an application from a .dbf file.
> I know it is possible with Dquery to convert a file to a .txt file, but I
> want to build it in in a .wfm file or program.
> How can I do this.
> Please some help in this


The following is an example that might get you started:

d=new database()
d.databasename := "dbasesamples"
d.active := true

q=new query()
q.database := d
q.sql := "select * from fish"
q.active := true

f = new file()
f.create("Temp.txt")

do
cString = q.rowset.fields['name'].value
cString += q.rowset.fields['species'].value
f.puts( cString )
until not q.rowset.next()
f.close()

run(true, "notepad.exe temp.txt")
J. Trouwborst

2005-03-28, 6:10 pm

Michael,
Your solution is what I needed.
Now we are testing some things, and it is working.
Thank you very much

Jan Trouwborst



"Michael Nuwer [dBVIPS]" <nuwermj@no.spam.yahoo.com> schreef in bericht
news:Z5mFblLKFHA.152@news-server...
> J. Trouwborst wrote:
I[vbcol=seagreen]
>
> The following is an example that might get you started:
>
> d=new database()
> d.databasename := "dbasesamples"
> d.active := true
>
> q=new query()
> q.database := d
> q.sql := "select * from fish"
> q.active := true
>
> f = new file()
> f.create("Temp.txt")
>
> do
> cString = q.rowset.fields['name'].value
> cString += q.rowset.fields['species'].value
> f.puts( cString )
> until not q.rowset.next()
> f.close()
>
> run(true, "notepad.exe temp.txt")



Michael Nuwer [dBVIPS]

2005-03-28, 6:10 pm

J. Trouwborst wrote:
> Michael,
> Your solution is what I needed.
> Now we are testing some things, and it is working.


Great!

> Thank you very much


You're welcome.
--
Michael Nuwer
http://www.nuwermj.potsdam.edu/dLearn/
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com