Does ADO.net have equivalent to ADODB.Recordset.GetString() in VB6

G

Guest

Hi,

This is a question about performance.

We executed a SqlClient.SqlCommand to fill a dataset with 10 recordsets from
SQL database and exported to the datafiles in text format. It is very slow
with large data set. Then I changed to use datareader and had the speed
improved about 50%. However, we still have to loop through each row, each
column in a row to get the data for each recordset and the speed is not
acceptable, especially compared to our VB6 application where to use
ADODB.Recordset.GetString() to dump one row at a time to the text file.

Does ADO.net have equivalent function to ADODB.Recordset.GetString() in VB6?

Thanks
 
C

Cor Ligthert

Beve,

You mean something as roughly typed in this message

\\\
dim sb as new sb()
For each dr as datarow in myDatatable
for i = 0 to dr.itemarray.length - 1
sb.append(dr(i).ToString)
sb.append(" ")
next
sb.append(vbcrlf)
Next
MyTextbox.text = sb.ToString
///

I thought that it was not in .Net

Cor
 
C

Cor Ligthert

typo I saw

dim sb as new sb()
has to be
dim sb as new system.text.stringbuilder()
 
P

Paul Clement

¤ Hi,
¤
¤ This is a question about performance.
¤
¤ We executed a SqlClient.SqlCommand to fill a dataset with 10 recordsets from
¤ SQL database and exported to the datafiles in text format. It is very slow
¤ with large data set. Then I changed to use datareader and had the speed
¤ improved about 50%. However, we still have to loop through each row, each
¤ column in a row to get the data for each recordset and the speed is not
¤ acceptable, especially compared to our VB6 application where to use
¤ ADODB.Recordset.GetString() to dump one row at a time to the text file.
¤
¤ Does ADO.net have equivalent function to ADODB.Recordset.GetString() in VB6?

Can you perform the export directly from SQL Server to the text file?

Function ExportSQLServerToText() As Boolean

Dim TextConnection As New
System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & "E:\My
Documents\TextFiles" & ";" & _
"Extended
Properties=""Text;HDR=NO;""")

TextConnection.Open()

'New table
Dim TextCommand As New System.Data.OleDb.OleDbCommand("SELECT * INTO [Orders#txt] FROM
[Orders] IN '' [ODBC;Driver={SQL
Server};Server=(local);Database=Northwind;Trusted_Connection=yes];", TextConnection)

TextCommand.ExecuteNonQuery()
TextConnection.Close()

End Function


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 

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