ADO.NET-VS-ADO

S

sterling

Here's the deal, this method was great for creating delimited files on the
fly using ADO

GetString Method
Returns the Recordset as a string.
Syntax:
Variant = recordset.GetString(StringFormat, NumRows, ColumnDelimiter,
RowDelimiter, NullExpr)

What is an equivalent solution using ADO.NET, without looping through fields
& records and using the Split Method
Too much overhead. I need a solution, and why didn't Microsoft add this
method to ADO.NET.

Thanks,
Sterling
 
H

Hirantha

AFAIK Only way to do this without looping through is by reading the data
into a DataSet or an XmlReader, then apply an XSL transform to XML.
 
S

sterling

The old method Getstring I used to export a whole table as a CSV file by
setting the correct parameters in GetString.
Then writing the returned result to a file.
For example in VBScript.............
Dim rsQuery
Set rsTable = Server.CreateObject("ADODB.Recordset")
Set dbConn = Server.CreateObject("ADODB.Connection")
dbConn.Open Session("DSN"), ("Username"), ("Pass")
rsQuery = "SELECT * FROM " & ("Table") & ";"
rsTable.CursorLocation = 3
rsTable.Open rsQuery, dbConn, 0, 3
strDelimiter = ","
If Not rsTable.EOF Then
varOutput = rsTable.GetString (adClipString,,strDelimiter,vbCR,"")
Set f = Filesystem.GetFile ("C:\Export\Export.csv")
Set TextFile = f.OpenAsTextStream(2, 0)
TextFile.Write varOutput
TextFile.Close
End If

I wouldn't be able to do the same with XML, would I ????
I mean as to transform the XML as comma seperated values.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top