Foros del Web » Programación para mayores de 30 ;) » .NET »

Mostrar con crystal reports [problema al quere imprimir por segunda vez]

Estas en el tema de Mostrar con crystal reports [problema al quere imprimir por segunda vez] en el foro de .NET en Foros del Web. Buenas a todos, gracias de antemano por a ayuda. Tengo éste método en VB2010 para abrir reports del Crystal Reports, hice un método común para ...
  #1 (permalink)  
Antiguo 13/01/2012, 07:21
 
Fecha de Ingreso: septiembre-2010
Ubicación: http://nomenrecordo.blogspot.com/
Mensajes: 111
Antigüedad: 13 años, 6 meses
Puntos: 1
Pregunta Mostrar con crystal reports [problema al quere imprimir por segunda vez]

Buenas a todos, gracias de antemano por a ayuda.

Tengo éste método en VB2010 para abrir reports del Crystal Reports, hice un método común para optimizar mejor el código pero me encuentro que cuando quiero mostrar un formulario después de haber mostrado otro me da error a la hora de agregar el DataSource al objeto Crystal Reports

Código:
Public Sub CrearReport(ByVal StrSqlCabecera As String, ByVal FileName As String, ByVal Salida As String, Optional ByVal Descripcion As String = "", Optional ByVal Condiciones As String = "No", Optional ByVal StrSqlLineas As String = "", Optional ByVal FiltrarIdLineas As String = "", Optional ByVal StrOrderByLineas As String = "", Optional ByVal CampoID As String = "Id", Optional ByVal NombreLineas As String = "Lineas")
        Dim crtableLogoninfo As New TableLogOnInfo
        Dim crConnectionInfo As New ConnectionInfo
        Dim dt As Data.DataTable
        Dim dtsReport As New DataSet
        Dim strAux As String = ""
        dt = ObtenerDataTable(StrSqlCabecera) 'STRSQLCABECERA
        dt.TableName = "cabecera"
        dtsReport.Tables.Add(dt)
        If FiltrarIdLineas <> "" Then
            For aux_fila = 0 To dt.Rows.Count - 1
                strAux += " or " + FiltrarIdLineas + " = " + CntVal(ValCnt(dt.Rows(aux_fila).Item(CampoID)), "null")
            Next
            StrSqlLineas += " where 1=1 and (" + strAux.Substring(4, strAux.Length - 4) + ")"
        End If
        dt = Nothing

        If StrSqlLineas <> "" Then
            If StrOrderByLineas <> "" Then StrSqlLineas += StrOrderByLineas
            dt = ObtenerDataTable(StrSqlLineas) 'STRSQLLINEAS [OPCIONAL]
            dt.TableName = NombreLineas
            dtsReport.Tables.Add(dt)
            dt = Nothing
        End If

        Dim cryRpt As New ReportDocument

        cryRpt.FileName = CurDir() & FileName 'FILENAME PER PARÀMETRE
        cryRpt.SetDataSource(dtsReport)
        dtsReport = Nothing

        If Descripcion <> "" Then
            cryRpt.DataDefinition.FormulaFields.Item("FNomEmp").Text = CntStr(NOMBRE_EMPRESA, "Sí")
            cryRpt.DataDefinition.FormulaFields.Item("FTitLis").Text = CntStr(Descripcion, "Sí") 'DESCRIPCIÓN PER PARÀMETRE
            cryRpt.DataDefinition.FormulaFields.Item("FUsuario").Text = CntStr(USUARIO, "Sí")

            'CONDICIONES PER PARÀMETRE [OPCIONAL]

            If Condiciones <> "No" Then cryRpt.DataDefinition.FormulaFields.Item("FCon1").Text = CntStr(Trim(Condiciones), "Sí")
        End If

        ImprimirReport(cryRpt, Salida)

        crConnectionInfo = Nothing
        crtableLogoninfo = Nothing
        cryRpt.Dispose()
        cryRpt = Nothing
    End Sub

Etiquetas: crystal, reports, segunda, sql, vb
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 10:57.