子报告密码提示不会消失,也会失败。 [英] Subreport password prompt won't go away, and also fails.

查看:43
本文介绍了子报告密码提示不会消失,也会失败。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

没有子报告的主报告工作正常。两者都通过相同的ODBC连接使用存储的
过程。当附加了带有
链接参数的子报表时,系统会提示我输入密码,当
给出最绝对正确的密码时,它会失败。 SQL服务器是
将它记录为一个错误的密码,但它确实很好并且通过应用程序使用
完全相同,而且我用它直接登录到
服务器,没问题。是的,我确实应用了最新的CR补丁
。请帮助?

我正在使用Visual Basic 2005(Visual Studio)和包含的Crystal Reports版本。我在运行应用程序的同一台机器上使用SQL Server 2005。操作系统是Windows Small Business Server 2003.



公共操作新的MyReport0001'这是一个使用的强类型报告

私有子按钮7_Click(ByVal sender As System.Object ,ByVal e As System.EventArgs)处理Button7.Click
'
'Crystal Reports变量
Dim subRepDoc As New ReportDocument()
Dim crSection As Section
Dim crSections As Sections
Dim crTables As Tables
Dim crTable As Table
Dim crLogOnInfo As TableLogOnInfo
Dim crConnInfo As New ConnectionInfo()
Dim crParameterValues As ParameterValues
Dim crReportObjects As ReportObjects
Dim crReportObject As ReportObject < br> Dim crSubreportObject As SubreportObject
Dim crDatabase As Database
Dim crParameterDiscreteValue As ParameterDiscreteValue
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldDe finition作为ParameterFieldDefinition

crDatabase = oRpt.Database
crTables = crDatabase.Tables

每个crTable in crTables
with crConnInfo
.ServerName ="。" < br> .DatabaseName =" MasterDB"
.UserID =" appUser"
.Password =" MyP @ ssword"
End with
crLogOnInfo = crTable.LogOnInfo
crLogOnInfo.ConnectionInfo = crConnInfo
crTable.ApplyLogOnInfo(crLogOnInfo)



'crTable.Location = myDBName& "。" &安培; myOwner& "。" &安培;
crTable.Location.Substring(crTable.Location.LastIndexOf("。")+ 1)

'使用报表部分设置sections集合
crSections = oRpt.ReportDefinition.Sections < br>
'遍历每个部分并查找所有报表对象
'循环遍历所有报表对象以查找所有子报表对象,然后将
'logoninfo设置为子报表

For每个crSection in crSections
crReportObjects = crSection.ReportObjects
For each crReportObject in crReportObjects
if crReportObject.Kind = ReportObjectKind.SubreportObject Then

'如果找到子报表,则将报表对象强制转换为子报表对象
crSubreportObject = CType(crReportObject,SubreportObject)源码下载

打开子报表
subRepDoc = crSubreportObject.OpenSubreport(crSubreportObject.SubreportName)

crDatabase = subRepDoc.Database
crTables = crDatabase.Tables

'遍历每个表并设置连接信息
'将连接信息传递给logoninfo对象然后应用
'logoninfo到子报告

每个crTable in crTables
使用crConnInfo
.ServerName ="。"
.DatabaseName =" MasterDB"
.UserID =" appUser" < br> .Password =" MyP @ ssword"
End with
crLogOnInfo = crTable.LogOnInfo
crLogOnInfo.ConnectionInfo = crConnInfo
crTable.ApplyLogOnInfo(crLogOnInfo)



>结束如果
下一页
下一页



'*****************************
'将存储过程参数传递给报告
'*****************************
'获取收集报告中的参数
crParameterFieldDefinitions = oRpt.DataDefinition.ParameterFields
'从集合中访问指定的参数
crParameterFieldDefinition = crParameterFieldDefinitions.Item(" @ InspectionID")
'从中获取当前值参数字段。此时
'设置零值。
crParameterValues = crParameterFieldDefinition.CurrentValues
'清除现有参数值
crParameterValues.Clear()
'设置数值参数字段的当前值
crParameterDiscreteValue = New ParameterDiscreteValue()
crParameterDiscreteValue.Value = Me.RecordIdTextBox.Text
'为参数字段添加当前值
crParameterValues.Add(crParameterDiscreteValue)
'当前参数值必须应用于参数字段。
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
ReportViewer.CrystalReportViewer1.ReportSource = oRpt
ReportViewer.Show()
End Sub

My main report without the subreport works okay. Both use a stored procedure through an identical ODBC connection. When the subreport with linked parameter is attached, I get prompted for the password, and when giving it the most definitely correct password, it fails. SQL server is logging it as a bad password, but it is DEFINITELY GOOD and is used identically all through the app, and I am logging directly into the server with it, no problem. Yes, I do have the latest CR patches applied. PLEASE help?

I am using Visual Basic 2005 (Visual Studio) and the included version of Crystal Reports.  I am using SQL Server 2005 on the same machine that the app runs on.  OS is Windows Small Business Server 2003.



Public oRpt As New MyReport0001 'This is a strongly typed report being used

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
'
'Crystal Reports Variables
Dim subRepDoc As New ReportDocument()
Dim crSection As Section
Dim crSections As Sections
Dim crTables As Tables
Dim crTable As Table
Dim crLogOnInfo As TableLogOnInfo
Dim crConnInfo As New ConnectionInfo()
Dim crParameterValues As ParameterValues
Dim crReportObjects As ReportObjects
Dim crReportObject As ReportObject
Dim crSubreportObject As SubreportObject
Dim crDatabase As Database
Dim crParameterDiscreteValue As ParameterDiscreteValue
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldDefinition As ParameterFieldDefinition

crDatabase = oRpt.Database
crTables = crDatabase.Tables

For Each crTable In crTables
With crConnInfo
.ServerName = "."
.DatabaseName = "MasterDB"
.UserID = "appUser"
.Password = "MyP@ssword"
End With
crLogOnInfo = crTable.LogOnInfo
crLogOnInfo.ConnectionInfo = crConnInfo
crTable.ApplyLogOnInfo(crLogOnInfo)
Next
'crTable.Location = myDBName & "." & myOwner & "." & crTable.Location.Substring(crTable.Location.LastIndexOf(".") + 1)

'Set the sections collection with report sections
crSections = oRpt.ReportDefinition.Sections

'Loop through each section and find all the report objects
'Loop through all the report objects to find all subreport objects, then set the
'logoninfo to the subreport

For Each crSection In crSections
crReportObjects = crSection.ReportObjects
For Each crReportObject In crReportObjects
If crReportObject.Kind = ReportObjectKind.SubreportObject Then

'If you find a subreport, typecast the reportobject to a subreport object
crSubreportObject = CType(crReportObject, SubreportObject)

'Open the subreport
subRepDoc = crSubreportObject.OpenSubreport(crSubreportObject.SubreportName)

crDatabase = subRepDoc.Database
crTables = crDatabase.Tables

'Loop through each table and set the connection info
'Pass the connection info to the logoninfo object then apply the
'logoninfo to the subreport

For Each crTable In crTables
With crConnInfo
.ServerName = "."
.DatabaseName = "MasterDB"
.UserID = "appUser"
.Password = "MyP@ssword"
End With
crLogOnInfo = crTable.LogOnInfo
crLogOnInfo.ConnectionInfo = crConnInfo
crTable.ApplyLogOnInfo(crLogOnInfo)
Next

End If
Next
Next



'*****************************
' Pass the Stored Procedure parameter to the report
'*****************************
'Get the collection of parameters from the report
crParameterFieldDefinitions = oRpt.DataDefinition.ParameterFields
'Access the specified parameter from the collection
crParameterFieldDefinition = crParameterFieldDefinitions.Item("@InspectionID")
'Get the current values from the parameter field. At this point
'there are zero values set.
crParameterValues = crParameterFieldDefinition.CurrentValues
'Clear existing parameter values
crParameterValues.Clear()
'Set the current values for the numeric parameter field
crParameterDiscreteValue = New ParameterDiscreteValue()
crParameterDiscreteValue.Value = Me.RecordIdTextBox.Text
'Add the current value for the parameter field
crParameterValues.Add(crParameterDiscreteValue)
'The current parameter values must be applied for the parameter field.
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
ReportViewer.CrystalReportViewer1.ReportSource = oRpt
ReportViewer.Show()
End Sub

推荐答案

当然这可以通过Crystal Reports完成吗?
Surely this can be done with Crystal Reports?


这篇关于子报告密码提示不会消失,也会失败。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆