[VB.NET]高手帮忙,水晶报表显示在网页上的内容不更新,在线等,只有40分了

前端之家收集整理的这篇文章主要介绍了[VB.NET]高手帮忙,水晶报表显示在网页上的内容不更新,在线等,只有40分了前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
高手帮忙,水晶报表显示在网页上的内容不更新,在线等,只有40分了 我新建个网站,加入一个CrystalReportViewer1,然后填加下面代码,其它的什么也不做,但运行后只显示做水晶报表时的数据记录在网页上,即使更改参数的值再运行,也是这样,即参数没有传进去。 请问高手为什么啊? 下面的代码是用来打开c:/a/IndentedCurrentBillOfMaterial.rpt报表,加入了参数和登录信息 Imports CrystalDecisions.CrystalReports.Engine Imports CrystalDecisions.Shared Partial Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object,ByVal e As System.EventArgs) Handles Me.Load Dim logonInfo As New TablelogonInfo Dim oRpt As New ReportDocument Dim i As Int16 Dim tmp As DBNull oRpt.Load( "c:/a/IndentedCurrentBillOfMaterial.rpt ") For i = 0 To oRpt.Database.Tables.Count - 1 logonInfo.ConnectionInfo.UserID = "sa " logonInfo.ConnectionInfo.ServerName = "it-zmyang " logonInfo.ConnectionInfo.DatabaseName = "AB_APP " logonInfo.ConnectionInfo.Password = "123 " oRpt.Database.Tables(0).ApplylogonInfo(logonInfo) Next ''CrystalReportViewer1.ReportSource = oRpt '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' Dim paramFields As New ParameterFields Dim paramField As New ParameterField Dim discreteVal As New ParameterDiscreteValue Dim rangeVal As New ParameterRangeValue '' 第一个参数是具有多个值的离散参数。 '' 设置参数字段的名称,它必须 ''和报表中的参数相符。 paramField.ParameterFieldName = "@StartingItem " '' 设置第一个离散值并将其传递给该参数 discreteVal.Value = "FG-AL03AU0100-B " paramField.CurrentValues.Add(discreteVal) '' 设置第二个离散值并将其传递给该参数。 '' discreteVal 变量被设置为新值,这样,以前的设置 ''就不会被覆盖。 ''discreteVal = New ParameterDiscreteValue ''discreteVal.Value = "FG-AL01AU0100 " ''paramField.CurrentValues.Add(discreteVal) '' 将该参数添加到参数字段集合。 paramFields.Add(paramField) paramField = New ParameterField paramField.ParameterFieldName = "@EndingItem " discreteVal.Value = "FG-AL03AU0100-B " paramField.CurrentValues.Add(discreteVal) paramFields.Add(paramField) paramField = New ParameterField paramField.ParameterFieldName = "@StartingProCode " discreteVal.Value = tmp paramField.CurrentValues.Add(discreteVal) paramFields.Add(paramField) paramField = New ParameterField paramField.ParameterFieldName = "@EndingProCode " discreteVal.Value = tmp paramField.CurrentValues.Add(discreteVal) paramFields.Add(paramField) paramField = New ParameterField paramField.ParameterFieldName = "@MaterialType " discreteVal.Value = tmp paramField.CurrentValues.Add(discreteVal) paramFields.Add(paramField) paramField = New ParameterField paramField.ParameterFieldName = "@Source " discreteVal.Value = tmp paramField.CurrentValues.Add(discreteVal) paramFields.Add(paramField) paramField = New ParameterField paramField.ParameterFieldName = "@Stocked " discreteVal.Value = tmp paramField.CurrentValues.Add(discreteVal) paramFields.Add(paramField) paramField = New ParameterField paramField.ParameterFieldName = "@ABCCode " discreteVal.Value = tmp paramField.CurrentValues.Add(discreteVal) paramFields.Add(paramField) paramField = New ParameterField paramField.ParameterFieldName = "@EffectiveDate " discreteVal.Value = tmp paramField.CurrentValues.Add(discreteVal) paramFields.Add(paramField) paramField = New ParameterField paramField.ParameterFieldName = "@EffectiveDateOffset " discreteVal.Value = tmp paramField.CurrentValues.Add(discreteVal) paramFields.Add(paramField) paramField = New ParameterField paramField.ParameterFieldName = "@PageJob " discreteVal.Value = tmp paramField.CurrentValues.Add(discreteVal) paramFields.Add(paramField) paramField = New ParameterField paramField.ParameterFieldName = "@PrintLevelZero " discreteVal.Value = tmp paramField.CurrentValues.Add(discreteVal) paramFields.Add(paramField) paramField = New ParameterField paramField.ParameterFieldName = "@DisplayRefer " discreteVal.Value = tmp paramField.CurrentValues.Add(discreteVal) paramFields.Add(paramField) paramField = New ParameterField paramField.ParameterFieldName = "@DisplayHeader " discreteVal.Value = tmp paramField.CurrentValues.Add(discreteVal) paramFields.Add(paramField) paramField = New ParameterField paramField.ParameterFieldName = "@PrintAlternateMaterials " discreteVal.Value = tmp paramField.CurrentValues.Add(discreteVal) paramFields.Add(paramField) paramField = New ParameterField paramField.ParameterFieldName = "@FgTypeQty " discreteVal.Value = tmp paramField.CurrentValues.Add(discreteVal) paramFields.Add(paramField) paramField = New ParameterField paramField.ParameterFieldName = "@FgQty " discreteVal.Value = tmp paramField.CurrentValues.Add(discreteVal) paramFields.Add(paramField) paramField = New ParameterField paramField.ParameterFieldName = "@StartVendorItem " discreteVal.Value = tmp paramField.CurrentValues.Add(discreteVal) paramFields.Add(paramField) paramField = New ParameterField paramField.ParameterFieldName = "@EndVendorItem " discreteVal.Value = tmp paramField.CurrentValues.Add(discreteVal) paramFields.Add(paramField) '' 将参数字段集合放入查看器控件。 CrystalReportViewer1.ParameterFieldInfo = paramFields CrystalReportViewer1.ReportSource = oRpt End Sub End Class __________________________________________________________________________ 你paramField.ParameterFieldName = "@EndingItem "这里的值跟报表中的参数相符吗? discreteVal.Value = tmp 感觉这里有问题 __________________________________________________________________________ '' 新建一个离散值 discreteVal = New ParameterDiscreteValue() 把这句加上去。 __________________________________________________________________________ 我只选其中一个项目,即开始和结束一样的,这个没问题 关键问题是参数和服务器注册信息没有被接受,我只留下面内容,报表一样的显示结果: Imports CrystalDecisions.CrystalReports.Engine Imports CrystalDecisions.Shared Partial Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object,ByVal e As System.EventArgs) Handles Me.Load Dim logonInfo As New TablelogonInfo Dim oRpt As New ReportDocument Dim i As Int16 Dim tmp As DBNull oRpt.Load( "c:/a/IndentedCurrentBillOfMaterial.rpt ") CrystalReportViewer1.ReportSource = oRpt end sub 也就是说那些没起作用,为什么啊? __________________________________________________________________________ 这样啊,感觉你少东西了。 基本格式: '' 设置报表源 oRpt = New ReportDocument() oRpt.Load(GetReportPath(RPT_NAME)) '' 设置参数 CrystalReportViewer1.ParameterFieldInfo = GetParameterInfo(CType(Session( "list "),ListItemCollection)) //这一句少了。 CrystalReportViewer1.ReportSource = oRpt '' 显示报表 CrystalReportViewer1.DataBind()//这一句少了。 __________________________________________________________________________ GetParameterInfo这个方法里是设置参数的 __________________________________________________________________________ 提示未申请GetParameterInfo这个方法啊 能否给完整代码我看看,TKS! __________________________________________________________________________ Imports CrystalDecisions.Shared Imports CrystalDecisions.CrystalReports.Engine Private Const RPT_NAME As String = "CustomerOrders.rpt " Private Const PARAMETER_FIELD_NAME As String = "CustomerID " Private Sub Page_Load(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles MyBase.Load ''在此处放置初始化页的用户代码 '' 设置报表源 report = New ReportDocument() report.Load(GetReportPath(RPT_NAME)) '' 设置参数 crvOrders.ParameterFieldInfo = GetParameterInfo(CType(Session( "list "),ListItemCollection)) crvOrders.ReportSource = report '' 显示报表 crvOrders.DataBind() End Sub __________________________________________________________________________ Private Function GetParameterInfo(ByVal list As ListItemCollection) As ParameterFields Dim item As ListItem Dim isEmpty As Boolean = True Dim itemCount As Integer = 0 '' 声明将参数传递给查看器控件所需的变量。 Dim paramFields As New ParameterFields() Dim paramField As New ParameterField() Dim discreteVal As New ParameterDiscreteValue() '' 参数是具有多个值的离散参数。 '' 设置参数字段的名称,它必须和报表中的参数相符。 paramField.ParameterFieldName = PARAMETER_FIELD_NAME For Each item In list If item.Selected Then isEmpty = False itemCount += 1 '' 设置一个离散值并将其传递给该参数 discreteVal.Value = item.Value paramField.CurrentValues.Add(discreteVal) '' 新建一个离散值 discreteVal = New ParameterDiscreteValue() End If Next If isEmpty Then For Each item In list '' 设置一个离散值并将其传递给该参数 discreteVal.Value = item.Value paramField.CurrentValues.Add(discreteVal) '' 新建一个离散值 discreteVal = New ParameterDiscreteValue() Next End If '' 将该参数添加到参数字段集合。 paramFields.Add(paramField) GetParameterInfo = paramFields End Function __________________________________________________________________________ 这程序一定有问题GetParameterInfo函数一个参数,而你调用时有两个参数 __________________________________________________________________________ 程序不成功,一样没用啊 __________________________________________________________________________ To yangzhum(yangzhum): 哪里调用时有两个参数????? GetParameterInfo(CType(Session( "list "),ListItemCollection)) 在这里CType(Session( "list "),ListItemCollection)是一个参数好伐!!!!!! __________________________________________________________________________ TO:LAOC() ( ) 应该是两个参数,不知怎的算一个,TKS! 原来是存储过程支持性很差,比喻先存储过程有条插入语句,最后一条select语句,则不成功 __________________________________________________________________________ 原文链接:https://www.f2er.com/vb/263795.html

猜你在找的VB相关文章