Link to home
Start Free TrialLog in
Avatar of aslyas
aslyas

asked on

Error on serialize value system.data.dataset of type system.data.dataset

Hi experts,

I am developing a report in crystal reportx XI R2 for asp.net application, there I make a query to get the records, as the query is processed iseveral times in a cicle to get all records I use a datatable to store the records, at the end the datatable is assigned to a dataset, but when that dataset is assigned to the report, an error occurrs saying:
Error al serializar el valor 'System.Data.DataSet' del valor 'System.Data.DataSet.' as my SO is in spanish error is in spanish, but it is something like the title of my question.

If it is called with few records (10) it works ok, but the problem appear after 1500 records.

Can any body helpme.

Tanks in advance.
dtsDatos = objSQL.GetDataSet(command, objConn)
                If dtsDatos.Tables(0).Rows.Count > 0 Then
                    nomTabla = "aceptacionRiesgosinPRBI_TD"
                    While i <= dtsDatos.Tables(0).Rows.Count - 1
                        row = dtsDatos.Tables(0).Rows(i)
                        MDNombre = row(0)
                        Select Case MDNombre
                            Case "ADELGAZAMIENTO"
                                dtrDatos = objConsulta.ConsultaAceptacionRiesgo(IdAnalisis, "spw_ConsultaAceptacionRiesgoAD", PeriodoInicial, PeriodoFinal, objConn)
                            Case "DAÑO EXTERNO"
                                dtrDatos = objConsulta.ConsultaAceptacionRiesgo(IdAnalisis, "spw_ConsultaAceptacionRiesgoDE", PeriodoInicial, PeriodoFinal, objConn)
                            Case "SCC_GENERAL"
                                dtrDatos = objConsulta.ConsultaAceptacionRiesgo(IdAnalisis, "spw_ConsultaAceptacionRiesgoSCC", PeriodoInicial, PeriodoFinal, objConn)
                            Case "FRACTURA FRAGIL"
                                dtrDatos = objConsulta.ConsultaAceptacionRiesgo(IdAnalisis, "spw_ConsultaAceptacionRiesgoFF", PeriodoInicial, PeriodoFinal, objConn)
                            Case "HTHA"
                                dtrDatos = objConsulta.ConsultaAceptacionRiesgo(IdAnalisis, "spw_ConsultaAceptacionRiesgoHTHA", PeriodoInicial, PeriodoFinal, objConn)
                            Case "LINING"
                                dtrDatos = objConsulta.ConsultaAceptacionRiesgo(IdAnalisis, "spw_ConsultaAceptacionRiesgoLNG", PeriodoInicial, PeriodoFinal, objConn)
                            Case "FATIGA MECANICA"
                                dtrDatos = objConsulta.ConsultaAceptacionRiesgo(IdAnalisis, "spw_ConsultaAceptacionRiesgoFMC", PeriodoInicial, PeriodoFinal, objConn)
                            Case "TUBOS DE HORNOS"
                                dtrDatos = objConsulta.ConsultaAceptacionRiesgo(IdAnalisis, "spw_ConsultaAceptacionRiesgoTBH", PeriodoInicial, PeriodoFinal, objConn)
                        End Select
                        If dtrDatos.HasRows Then
                            While dtrDatos.Read()
                                If tblResultados Is Nothing Then
                                    tblResultados = New Data.DataTable(nomTabla)
                                   tblResultados.Columns.Add("IdInstalacion", Type.GetType("System.Int32"))
                                    tblResultados.Columns.Add("INombre", Type.GetType("System.String"))
                                    tblResultados.Columns.Add("Logo", GetType(Byte())) 'Type.GetType("System.Byte()")
                                    tblResultados.Columns.Add("RTI", Type.GetType("System.Decimal"))
                                    tblResultados.Columns.Add("RTF", Type.GetType("System.Double"))
                                    tblResultados.Columns.Add("IdPlanta", Type.GetType("System.Int32"))
                                    tblResultados.Columns.Add("PNombre", Type.GetType("System.String"))
                                    tblResultados.Columns.Add("IdComponente", Type.GetType("System.Int64"))
                                    tblResultados.Columns.Add("CNombre", Type.GetType("System.String"))
                                    tblResultados.Columns.Add("Etiqueta", Type.GetType("System.String"))
                                    tblResultados.Columns.Add("IdAnalisis", Type.GetType("System.Int64"))
                                    tblResultados.Columns.Add("FechaAnalisis", Type.GetType("System.String"))
                                    tblResultados.Columns.Add("Tiempo", Type.GetType("System.Int16"))
                                    tblResultados.Columns.Add("vPRBI", Type.GetType("System.Int16"))
                                    tblResultados.Columns.Add("RI", Type.GetType("System.Decimal"))
                                    tblResultados.Columns.Add("RF", Type.GetType("System.Double"))
                                    tblResultados.Columns.Add("TDES", Type.GetType("System.Decimal"))
                                    tblResultados.Columns.Add("EPI", Type.GetType("System.String"))
                                    tblResultados.Columns.Add("EPRBI", Type.GetType("System.String"))                                    
                                End If
                              RI = dtrDatos(14)
                                RF = dtrDatos(15)
                              rowRes = tblResultados.NewRow()
                                rowRes(0) = dtrDatos(0) 'IdInstalacion
                                rowRes(1) = dtrDatos(1).ToString.Trim                            
                                If Not BytesLogo Is Nothing Then
                                    rowRes(2) = BytesLogo 'dtrDatos(2)
                                Else
                                    rowRes(2) = 0
                                End If
                                rowRes(3) = dtrDatos(3).ToString.Trim  
                                rowRes(4) = dtrDatos(4)  
                                rowRes(5) = dtrDatos(5) 
                                rowRes(6) = dtrDatos(6).ToString.Trim  
                                rowRes(7) = dtrDatos(7)  
                                rowRes(8) = dtrDatos(8).ToString.Trim  
                                rowRes(9) = dtrDatos(9).ToString.Trim  
                                rowRes(10) = dtrDatos(10)  
                                rowRes(11) = dtrDatos(11).ToString.Trim  
                                rowRes(12) = dtrDatos(12)  
                                rowRes(13) = dtrDatos(13) 
                                rowRes(14) = RI 'dtrDatos(14) 
                                rowRes(15) = RF 'dtrDatos(15)                                 
                                 rowRes(16) = 0
                                 rowRes(17) = dtrDatos(17)
                                rowRes(18) = dtrDatos(18)
                                tblResultados.Rows.Add(rowRes)
                                rowRes = Nothing
                            End While
                        End If
                        i += 1
                        If Not dtrDatos Is Nothing Then dtrDatos.Close()
                    End While
                End If            
            End If           
            consultaAceptacionRiesgo = New Data.DataSet()
            If Not tblResultados Is Nothing Then
                consultaAceptacionRiesgo.Tables.Add(tblResultados)
                If chkvPRBI.Checked = False Then
                    consultaAceptacionRiesgo.Tables(0).DefaultView.RowFilter = "vPRBI = 0"
                End If
            Else
                consultaAceptacionRiesgo.Tables.Add()
            End If

Open in new window

Avatar of Mike McCracken
Mike McCracken

Where do you initialize i?

mlmcc
Avatar of aslyas

ASKER

where it is declared, in the begin of the function, the code was not included, but it says:
Dim i as Int16 = 0
Avatar of aslyas

ASKER

I add code to ensure the datatable is cleaned with tblResultados.Dispose() and tblResultados  = nothing, but I am getting the error System.OutOfMemoryException, do you know if there is a record limit in a data table, the total query rows are around 1500 records.

Thanks in advance for your help.
There is a limit I am sure but I thought it was more controlled by the record size and the available physical and virtual memory.

I don't see anything in the code that seems to be a problem.

mlmcc
Avatar of aslyas

ASKER

I found the problem, after the total records are stored in datatable and assigned to dataset, it is not showed in the code because is in another function, there I  was saving the records in a viewstate, to avoid accessing database in each postback, I found that when big data are stored with viewstate property, that kind of problems happen.

Thanks any way for your answer.

ASKER CERTIFIED SOLUTION
Avatar of ee_auto
ee_auto

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial