on 12-18-2008 3:50 PM
Hello to everybody,
I have a little problem. I 've created a report that it's called from an application developed in vb.net.
The report shows all results if it is called from my computer but there are some users who shows the report without results.
This problem only occurs if the report has params in a stored procedure.
Sorry because my english is not very well...
Any suggestion?
Do you get any error message or is it that the report runs but does not give you any data?
Do you have any Row level security built in the universe?
Kashif
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jose,
I think we will need more detail.
Row level security is an option in an BO universe that allows you provide restriction on what data each user has access to.
Can you tell me are you connecting the report directly to a store procedure, or are you using Business Views or a Business Objects universe.
Regards
Alan
Hi Alan,
I'm connecting the report directly to a stored procedure. I'm not passing the credentials throught the connection.
I'm posting a little bite of code if it can help you:
// code in button
Dim FrmLis As New FrmVerReport
Dim Report As ReportDocument = Nothing
Dim valorAlm as string=u201D%u201D
Dim Ms as String=u201Du201D
Dim Filtro as String=u201Du201D
Try
If FrmLis.LOAD_RPT("CobrosPendientes", "Cobros pendientes", 2,CodigoEmpresa, UserBD, PassBD, CodigoEmpresa, Nothing, Report) Then
Report.DataDefinition.FormulaFields("Filtro").Text = FormatoTextoCrystal(Filtro)
'filtros
Ms = "{CobrosPendientes;1.activo}='S'" Report.RecordSelectionFormula = Ms
Report.SetParameterValue(0, valorAlm)
FrmLis.SHOW_RPT(Report)
End If
Catch ex As Exception
EnviaMensajeError("Error al visualizar el documento")
Finally
FrmLis.UNLOAD_RPT(Report)
End Try
// code in form FrmVerReport
Public Function LOAD_RPT(ByVal ArchivoRpt As String, ByVal Titulo As String, ByVal TipBd As Integer, ByVal Empresa As String, ByVal UserConex As String, ByVal PassConex As String, ByVal BdNom As String, ByVal PathBaseDatos As String, ByRef Report As ReportDocument) As Boolean
Dim DSNConn As String = ""
Dim crDocumentoSubreporte As ReportDocument
Dim crObjetoSubreporte As SubreportObject
Dim crInfoLogOnTabla As TableLogOnInfo
Dim crInfoConexion As ConnectionInfo
Dim crTablas As Tables, crTablasSubreporte As Tables
Try
EmpRpt = Empresa
ArchivoRpt = DirReports & ArchivoRpt & ".RPT"
DSNConn = "DSN" & Empresa
CrReport.Load(ArchivoRpt, OpenReportMethod.OpenReportByDefault)
CrReport.RecordSelectionFormula = Nothing
crInfoConexion = New ConnectionInfo()
crInfoConexion.ServerName = DSNConn
crInfoConexion.DatabaseName = BdNom
crInfoConexion.UserID = UserConex
crInfoConexion.Password = PassConex
crTablas = CrReport.Database.Tables
Dim crTabla As Table
For Each crTabla In crTablas
crInfoLogOnTabla = crTabla.LogOnInfo
crInfoLogOnTabla.ConnectionInfo = crInfoConexion
crTabla.ApplyLogOnInfo(crInfoLogOnTabla)
'Buscar subreportes, en todas las secciones del reporte
Dim crSeccion As Section
For Each crSeccion In CrReport.ReportDefinition.Sections
Dim crObjetoReporte As ReportObject
For Each crObjetoReporte In crSeccion.ReportObjects
If crObjetoReporte.Kind = ReportObjectKind.SubreportObject Then
crObjetoSubreporte = CType(crObjetoReporte, SubreportObject)
crDocumentoSubreporte = crObjetoSubreporte.OpenSubreport(crObjetoSubreporte.SubreportName)
crTablasSubreporte = crDocumentoSubreporte.Database.Tables
Dim crTablaSubreporte As Table
For Each crTablaSubreporte In crTablasSubreporte
crInfoLogOnTabla = crTabla.LogOnInfo
crInfoLogOnTabla.ConnectionInfo = crInfoConexion
crTablaSubreporte.ApplyLogOnInfo(crInfoLogOnTabla)
Next
End If
Next
Next
Next
LOAD_RPT = True
Report = CrReport
Catch ex As Exception
EnviaMensajeInfo("CargaRpt " & Err.Number & vbCrLf & Err.Description)
CARGA_RPT = False
End Try
End Function
Public Function SHOW_RPT(ByRef RptExp As ReportDocument) As Boolean
CrReport = RptExp
CrViewer1.ReportSource = CrReport
'CrViewer1.Refresh()
'CrViewer1.RefreshReport()
CrViewer1.Show()
Me.Cursor = Cursors.Default
Me.Show()
PINTA_RPT = True
End Function
Regards.
Hi,
The userBd is "sa" and the password is the same that sql server. I've tested it in my computer and it runs correctly (in some computers it's runs correctly after installing crredist2008x86.msi_ ). I think the problem could be something about .net configuration or pc client configuration, but I don't find it.
thanks for your time.
Hi Alan,
test by test I've find the solution. I was passing the user as a parameter and I had a recordselectionformula with this user :
Report.SetParameterValue(3, CodUser)
Ms = "{CobrosPendientes;1.user}='" & CodUser & "' "
Report.RecordSelectionFormula = Ms
the problem appears when the user is validating in the aplication in lower case. I've solved the problem with the following code :
CodUser=CodUser.tostring.toupper
Finally I think it could be a problem with keys sensitive between .net,crystal reports and sql server because I'm using the same stored procedure in a datagridview and it returns rows.
thanks a lot, Alan.
see you another time
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.