• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 334
  • Last Modified:

Read an entire ado recordset row?

Is there a way to read the entire recordset row in order to write to a file in one shot and add delimeters to the fields without looping through each field?
0
surfsista9
Asked:
surfsista9
1 Solution
 
Naveen SwamyYash Infinite Solutions Private LimitedCommented:
getrows and getstring

check out there help and use it, it is far better than using/looping the rs objects
0
 
mah8473Commented:
You could try incorporating DTS (Data Transformation Services) and Scripting.FileSystemObject, it's a bit long winded but it should work. Infact you could suck the whole recordset in as a DTSFlatFile and spit the lot out to you delimited text file.

Depending on how your retrieving your recordset? If its coming out of SQL using a stored Procedure it should be pretty easy.

check this out:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dtssql/dts_basic_5zg3.asp
0
 
mah8473Commented:
Navstar16,

good point getrows would be A hell of a lot easier!!!!!!!!!!!!!
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
surfsista9Author Commented:
The recordset is coming out of sql. I'd like something that sucks the entire recordset into a file with the option to delimit fields and crlf at each record.

I'll check out DTSFlatFile.
0
 
Leo EikelmanDirector, IT and Business DevelopmentCommented:
I don't know if there is such a solution, but this one is close


Dim rs as recordset
'Fill your recordset from database
.....
....
...
..

'and write this code
Dim strRS as string
Open "c:\rs.csv" for output as #1
while not rs.eof
 strRS=rs.GetString(adClipString,1,vbTab,vbTab,Empty)
 print #1,strData
 ' dont use rs.MoveNext
wend
close #1
set rs=nothing

you can fiddle with the .GetString method to get the format u want

Cheers,

Leo
0
 
Leo EikelmanDirector, IT and Business DevelopmentCommented:
: )
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

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