主题:vb.net 调用水晶报表2008的时候生成报表错误
dim crDoc As New CrystalDecisions.CrystalReports.Engine.ReportDocument
dim crDataBase As CrystalDecisions.CrystalReports.Engine.Database
dim crTables As CrystalDecisions.CrystalReports.Engine.Table
dim crLogOnInfo As New CrystalDecisions.Shared.TableLogOnInfo
dim crLogOnProp As New CrystalDecisions.Shared.NameValuePair2
crDoc.Load("D:\1.rpt")
crTables = crDoc.Database.Tables(0)
crLogOnInfo = crTables.LogOnInfo
crLogOnProp.Name = "Database Type"
crLogOnProp.Value = "ODBC (RDO)"
crLogOnInfo.ConnectionInfo.LogonProperties.Add(crLogOnProp)
crLogOnProp = crLogOnInfo.ConnectionInfo.LogonProperties.LookupNameValuePair("DSN")
crLogOnProp.Value = strDSNName
crLogOnProp = crLogOnInfo.ConnectionInfo.LogonProperties.LookupNameValuePair("UseDSNProperties")
crLogOnProp.Value = False
crDoc.Database.Tables(0).ApplyLogOnInfo(crLogOnInfo)
Dim crExportOptions As New CrystalDecisions.Shared.ExportOptions
Dim crDiskFileDestinationOptions As New CrystalDecisions.Shared.DiskFileDestinationOptions
crDiskFileDestinationOptions.DiskFileName = "d:\1.pdf"
With crExportOptions
.DestinationOptions = crDiskFileDestinationOptions
.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile
.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat
End With
crDoc.Export(crExportOptions)
以上部分是代码, 但是每次运行的时候都会出现上传文件中显示的错误, 请高手指点一二, 另一种数据库链接方式的没有什么问题, 另一种的数据库链接是
crLogOnInfo.ConnectionInfo.DatabaseName = "OraOLEDB.Oracle"
crLogOnInfo.ConnectionInfo.ServerName = strDBServerName
crLogOnInfo.ConnectionInfo.UserID = strDBUserName
crLogOnInfo.ConnectionInfo.Password = strDBPassword
crDoc.Database.Tables(0).ApplyLogOnInfo(crLogOnInfo)
dim crDataBase As CrystalDecisions.CrystalReports.Engine.Database
dim crTables As CrystalDecisions.CrystalReports.Engine.Table
dim crLogOnInfo As New CrystalDecisions.Shared.TableLogOnInfo
dim crLogOnProp As New CrystalDecisions.Shared.NameValuePair2
crDoc.Load("D:\1.rpt")
crTables = crDoc.Database.Tables(0)
crLogOnInfo = crTables.LogOnInfo
crLogOnProp.Name = "Database Type"
crLogOnProp.Value = "ODBC (RDO)"
crLogOnInfo.ConnectionInfo.LogonProperties.Add(crLogOnProp)
crLogOnProp = crLogOnInfo.ConnectionInfo.LogonProperties.LookupNameValuePair("DSN")
crLogOnProp.Value = strDSNName
crLogOnProp = crLogOnInfo.ConnectionInfo.LogonProperties.LookupNameValuePair("UseDSNProperties")
crLogOnProp.Value = False
crDoc.Database.Tables(0).ApplyLogOnInfo(crLogOnInfo)
Dim crExportOptions As New CrystalDecisions.Shared.ExportOptions
Dim crDiskFileDestinationOptions As New CrystalDecisions.Shared.DiskFileDestinationOptions
crDiskFileDestinationOptions.DiskFileName = "d:\1.pdf"
With crExportOptions
.DestinationOptions = crDiskFileDestinationOptions
.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile
.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat
End With
crDoc.Export(crExportOptions)
以上部分是代码, 但是每次运行的时候都会出现上传文件中显示的错误, 请高手指点一二, 另一种数据库链接方式的没有什么问题, 另一种的数据库链接是
crLogOnInfo.ConnectionInfo.DatabaseName = "OraOLEDB.Oracle"
crLogOnInfo.ConnectionInfo.ServerName = strDBServerName
crLogOnInfo.ConnectionInfo.UserID = strDBUserName
crLogOnInfo.ConnectionInfo.Password = strDBPassword
crDoc.Database.Tables(0).ApplyLogOnInfo(crLogOnInfo)