cancel
Showing results for 
Search instead for 
Did you mean: 

I have a report that shows results only with some users

Former Member
0 Kudos

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?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Jose,

It may be related to your connection. Are you passing the user credentials in the connection?

Regards

Alan

Former Member
0 Kudos

Hi kashif,

the viewer don't shows any error but shows the report without data (only some users). I don't know that you are refering about the row level security.

thanks for your reply

Former Member
0 Kudos

Hi Alan,

I'm passing the user "sa" throught an odbc connection. All users have the same odbc driver and the same odbc configuration.

I'm going to be crazy...

regards

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hi Jose,

What is the value in UserBD and PassBD. I would try hard coding them to SA and see if that makes a difference.

Regards

Alan

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hi Jose,

One last suggestion. Is it possible to run the query from the users machine through a SQL window. If so does it return rows?

Regards

Alan

Former Member
0 Kudos

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

Former Member
0 Kudos

Well done, excellent spot

Take care

Alan

Answers (0)