We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

Read an entire ado recordset row?

surfsista9
surfsista9 asked
on
Medium Priority
346 Views
Last Modified: 2010-05-18
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?
Comment
Watch Question

Naveen SwamyYash Infinite Solutions Private Limited

Commented:
getrows and getstring

check out there help and use it, it is far better than using/looping the rs objects

Commented:
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

Commented:
Navstar16,

good point getrows would be A hell of a lot easier!!!!!!!!!!!!!

Author

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.
Director, IT and Business Development
Commented:
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

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Leo EikelmanDirector, IT and Business Development

Commented:
: )
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.