我用我的表格中的值創建了一個Crystal Report。所有列都正確顯示,除了一個提前切斷的列。它應該說「測試10」,但「10」部分丟失。我連接到數據庫,但否決了代碼中的連接。在報告中被截斷的列文本
「10」部分是否因爲我的重寫而不顯示?或者是其他因素造成的?
Dim cryRpt As New ReportDocument()
cryRpt.Load("Location\report.rpt")
Dim cryRpttableLogoninfos As New TableLogOnInfos()
Dim cryRpttableLogoninfo As New TableLogOnInfo()
Dim cryRptConnectionInfo As New ConnectionInfo()
Dim cryRptTables As Tables
'para1
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldDefinition As ParameterFieldDefinition
Dim crParameterValues As New ParameterValues
Dim crParameterDiscreteValue As New ParameterDiscreteValue
crParameterDiscreteValue.Value = value
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields
crParameterFieldDefinition = crParameterFieldDefinitions.Item("@parameter")
crParameterValues = crParameterFieldDefinition.CurrentValues
crParameterValues.Clear()
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
'para2
Dim crParameterFieldDefinitions1 As ParameterFieldDefinitions
Dim crParameterFieldDefinition1 As ParameterFieldDefinition
Dim crParameterValues1 As New ParameterValues
Dim crParameterDiscreteValue1 As New ParameterDiscreteValue
crParameterDiscreteValue1.Value = value
crParameterFieldDefinitions1 = cryRpt.DataDefinition.ParameterFields
crParameterFieldDefinition1 = crParameterFieldDefinitions1.Item("@parameter1")
crParameterValues1 = crParameterFieldDefinition1.CurrentValues
crParameterValues1.Clear()
crParameterValues1.Add(crParameterDiscreteValue1)
crParameterFieldDefinition1.ApplyCurrentValues(crParameterValues1)
cryRptConnectionInfo.ServerName = servername
cryRptConnectionInfo.DatabaseName = databasename
cryRptConnectionInfo.UserID = userid
cryRptConnectionInfo.Password = password
cryRptConnectionInfo.IntegratedSecurity = False
cryRptTables = cryRpt.Database.Tables
For Each CrTable As CrystalDecisions.CrystalReports.Engine.Table In cryRptTables
cryRpttableLogoninfo = CrTable.LogOnInfo
cryRpttableLogoninfo.ConnectionInfo = cryRptConnectionInfo
CrTable.ApplyLogOnInfo(cryRpttableLogoninfo)
Next
cryRpt.RecordSelectionFormula = "{table.value} = " & value
我改變了報告上的數據庫連接,並禁用了vb.net中的代碼,該代碼否決了連接,但它仍然存在? – AntoonVs