Spire.DataExport for .NET is a 100% pure data .NET library suit for exporting data into MS Word, Excel, RTF, Access, PDF, XPS, HTML, XML, Text, CSV, DBF, SYLK, SQL Script, DIF, Clipboard, etc.

Mon Aug 13, 2012 12:48 pm

Hi,

I have a asp.net application to export from mysql to a txt and recived the error : "Timeout - TextExport::SaveToStream,var:"

My code:

--------------------------------------------------------------------------------------------------------
oleDbConnection1.ConnectionString = "Provider=SQLOLEDB;Data Source=XXXXXXXXXXXX;Initial Catalog=XXXXXX;User Id=XXX;password=XXXXXXXX;Connection Timeout=1800;"

Dim oleDbCommand1 As New System.Data.OleDb.OleDbCommand()

oleDbCommand1.CommandText = "SELECT XXXXXXXXXX"

oleDbCommand1.Connection = oleDbConnection1


Dim txtExport1 As New Spire.DataExport.TXT.TXTExport()

txtExport1.ActionAfterExport = Spire.DataExport.Common.ActionType.OpenView
txtExport1.DataFormats.CultureName = "zh-CN"
txtExport1.DataFormats.Currency = "c"
txtExport1.DataFormats.DateTime = "dd/MM/yyyy"
txtExport1.DataFormats.Float = "g"
txtExport1.DataFormats.[Integer] = "g"
txtExport1.DataFormats.Time = "H:mm"

txtExport1.DataEncoding = Spire.DataExport.Common.EncodingType.ASCII
txtExport1.SQLCommand = oleDbCommand1

oleDbConnection1.Open()

txtExport1.ExportType = Spire.DataExport.TXT.TextExportType.CSV
txtExport1.CSVOption.Separator = "|"
txtExport1.CSVOption.AllowQuote = False
txtExport1.
txtExport1.SaveToHttpResponse(arquivoNovo, Response)

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Thanks

Rubens

rubens.mv
 
Posts: 1
Joined: Fri Aug 03, 2012 4:10 pm

Tue Aug 14, 2012 9:50 am

Hi rubens.mv,

You must make sure that connect your database and get the data is successful. We can't reproduce your problem because we haven't your database. We provide you a way to verify connect the data which you want. Please check the following code. Hope it can help you.
Code: Select all
     Using oleDbConnection1 As New OleDbConnection
     oleDbConnection1.ConnectionString = "Provider=SQLOLEDB;Data Source=XXXXXXXXXXXX;Initial Catalog=XXXXXX;User Id=XXX;password=XXXXXXXX;Connection       Timeout=1800;"

            Dim oleDbCommand1 As New System.Data.OleDb.OleDbCommand()

            oleDbCommand1.CommandText = "SELECT XXXXXXXXXX"

            oleDbCommand1.Connection = oleDbConnection1

            Dim oleDbReader As OleDbDataReader = oleDbCommand1.ExecuteReader()
            If oleDbReader.HasRows Then
                'fetch data
                While oleDbReader.Read
                    oleDbReader.GetXXXX(x)
                End While
            End If
        End Using
    End Sub


Best wishes.
Amy
e-iceblue support
User avatar

amy.zhao
 
Posts: 2470
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.DataExport