[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 131
  • Last Modified:

Record to text file

I want to read a result of stored-procedure and transfer it out to a fixed length text file. Also , if I can have the option to change the data before I transfer it out to the text file.
0
eliasis
Asked:
eliasis
  • 2
1 Solution
 
ventondCommented:
Establish Recordset
Open file for output
do while recordset.eof = false
print file, data
recordset.movenext
loop
close file


Just make your "data" fixed length, your file will follow.
0
 
eliasisAuthor Commented:
What if I need to change data in a field before it would be transfered to text file?
0
 
DrDelphiCommented:
Sorry, No VB installed here...


Type  MyRecord
 Field1 as string *40
 Field2 as string *40
 Field3 as string *40
 end type
dim Arecord as Myrecord


in a button click, etc...

open "SomeFile.txt" for random as #1
  Arecord.filed1=recordset.filedX
  Arecord.filed2=recordset.filedX
  Arecord.filed3=recordset.filedX
  put #1,,Arecord
  close


-OF COURSE YOU'LL HAVE TO HANDLE SWAPPING DATA IN ARECORD PRIOR TO SAVING, BUT THIS GIVES YOU THE GENMERAL IDEA.

Good luck!!




0
 
ventondCommented:
before the print command, set the "data" to whatever you like. It doesn't even have to have anything to do with the recordset. YOU control what you print, YOU can change it, skip it, double print it, whatever.
0

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now