我新建一个报表实例m_Report,报表里有几个未绑定字段,我想要用数据库中的内容绑定这此未绑定字段,
以下是水晶报表9.2 示例中的代码,代码不会有问题.但是执行到第一句时报错:
实时错误 '-2147189571 (80047cbd)':
未启用创建功能这是什么意思?我用的是水晶报表9专业版,并已经注册了的.
m_Report.Database.AddOLEDBSource DataEnvironment1.Connection1, "Orders"
'上面这句不能执行,报错.
' Bind the five unbound fields to the newly added data source
With m_Report
.UnboundString1.SetUnboundFieldSource "{Orders.Ship Via}"
.UnboundCurrency1.SetUnboundFieldSource "{Orders.Order Amount}"
.UnboundBoolean1.SetUnboundFieldSource "{Orders.Shipped}"
.UnboundNumber1.SetUnboundFieldSource "{Orders.Customer ID}"
.UnboundDate1.SetUnboundFieldSource "{Orders.Order Date}"
End With
并且我发现 Database.AddADOCommand 这个命令也报一样的错误.难道专业版不提供此功能?(水晶报表8。0不会出错!) 我只好以Rs集来绑定报表中的未绑定字段
m_Report.Database.SetDataSource Rs但是后面的代码怎么写? 怎样用 RecordSet 集绑定水晶报表中未绑定字段?
谢谢各位!
以下是水晶报表9.2 示例中的代码,代码不会有问题.但是执行到第一句时报错:
实时错误 '-2147189571 (80047cbd)':
未启用创建功能这是什么意思?我用的是水晶报表9专业版,并已经注册了的.
m_Report.Database.AddOLEDBSource DataEnvironment1.Connection1, "Orders"
'上面这句不能执行,报错.
' Bind the five unbound fields to the newly added data source
With m_Report
.UnboundString1.SetUnboundFieldSource "{Orders.Ship Via}"
.UnboundCurrency1.SetUnboundFieldSource "{Orders.Order Amount}"
.UnboundBoolean1.SetUnboundFieldSource "{Orders.Shipped}"
.UnboundNumber1.SetUnboundFieldSource "{Orders.Customer ID}"
.UnboundDate1.SetUnboundFieldSource "{Orders.Order Date}"
End With
并且我发现 Database.AddADOCommand 这个命令也报一样的错误.难道专业版不提供此功能?(水晶报表8。0不会出错!) 我只好以Rs集来绑定报表中的未绑定字段
m_Report.Database.SetDataSource Rs但是后面的代码怎么写? 怎样用 RecordSet 集绑定水晶报表中未绑定字段?
谢谢各位!
解决方案 »
- VB录制屏幕上的图像,并保存为Avi格式
- 调试和运行状态下都出现automation错误---在线等
- 用VB做WEB组件时碰到的类模块之间调用的问题??
- 唉,原来VB不能读取记录号超过长整型数据范围的文件内容。
- 请问vb中报表如何动态生成?急!
- ★我用ActiveSkin4.1控件使窗体有了Cool外观,但是如何使菜单有图标呢?还有,主菜单可以skin,但右键弹出菜单如何也能skin呢?
- Ado 中Update 出现的问题
- 急急,为什么k = Int(Rnd * 10) 每次一开始运行都是7,然后就是5
- 我想用MsChart控件做图形报表,如何实现
- 请教一个复杂报表的问题
- 创建和访问Access2000数据库
- 高分相赠:关于MSCOMM通讯问题(在线等)
先加上引用
Declare Function vbEncodelPtr Lib "p2smon.dll" (x As Object) As String
Declare Function CreateFieldDefFile Lib "p2smon.dll" (lpUnk As Object, ByVal fileName As String, ByVal bOverWriteExistingFile As Long) As Long
Global job As Integer
Global Handle As Integer
代码:
Handle = PEOpenEngine
If Handle = 0 Then
Me.MousePointer = 0
MsgBox "A failure occurred when opening the Print Engine."
MsgBox "The error code is: " & PEGetErrorCode(Handle) 'ErrorNum
PEClosePrintJob job
PEClosePrintJob subReportjob
PECloseEngine
End If
job = PEOpenPrintJob(strPath)
Handle = SetActiveDataSource(job, 0, adoRs)
Handle = PEOutputToWindow(job, GetRptName(strPath), 0, 0, 520, 520, 0, 0) 'WS_MAXIMIZE, 0)
iResult = PESetWindowOptions(job, Windowoptions)
If iResult = 0 Then ' PESetWindowOptions failed
Screen.MousePointer = vbDefault
PEClosePrintJob job
PEClosePrintJob subReportjob
PECloseEngine
Exit Sub
End If
If Handle <> 0 Then
Handle = PEStartPrintJob(job, True)
If Handle <> 0 Then
'MsgBox "The report is printing."
Else
Me.MousePointer = 0
PEClosePrintJob job
PEClosePrintJob subReportjob
PECloseEngine
MsgBox "An error occurred while trying to Start the Print Job."
MsgBox "The error code is:" & PEGetErrorCode(job) 'ErrorNum
End If
Else
Me.MousePointer = 0
PEClosePrintJob job
PEClosePrintJob subReportjob
PECloseEngine
MsgBox "The output cannot be sent to the window."
MsgBox "The error code is: " & PEGetErrorCode(job) 'ErrorNum
End If
End If
PEClosePrintJob job
PEClosePrintJob subReportjob
PECloseEngine
这是在8.5下的ttx类型的报表,不知是否适合你的要求
Database.AddADOCommand 和 m_Report.Database.AddOLEDBSource 功能,
我想 desrie(leir)应该解决了吧!