VB6调用crystal v.92做的报表,总是出现数据库登陆对话框,不知道怎么办!!

0755 2003-10-24 11:17:05
环境:win2000,vb6,crystalv9.2,sqlserver2K

在Crystal中采用OLEDB连接数据库,vb6中调用Crystal做成的报表时,老是出现数据库登陆对话框,不知道怎么去除,请各位大侠多多指教,我的VB代码如下:



Dim CryApp As New CRAXDDRT.Application

Dim Report As CRAXDDRT.Report

Set Report = CryApp.OpenReport(App.Path & "\report\SampleBill.rpt")

'adoRS.Open "select top 10 * from answers", cnn1, adOpenDynamic, adLockBatchOptimistic

'Report.Database.SetDataSource adoRS

CRViewer91.ReportSource = Report

CRViewer91.ViewReport



...全文
53 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
wanchun312 2003-12-19
  • 打赏
  • 举报
回复
ok
diekiss 2003-12-03
  • 打赏
  • 举报
回复
请问楼上,
Tables(2)的"2"是代表什么的?
liuxum 2003-12-03
  • 打赏
  • 举报
回复
TO 0755
Call moxReport.Database.Tables(2).SetLogOnInfo("数据库名", "", "用户名", "密码")
0755 2003-12-01
  • 打赏
  • 举报
回复
请问下面语句中的 ("aplite2", "", "ct00", "nec") 分别是什么意思,数据库服务器? 登陆用户? 密码?

Call moxReport.Database.Tables(2).SetLogOnInfo("aplite2", "", "ct00", "nec")
diekiss 2003-12-01
  • 打赏
  • 举报
回复
cryTrialReport.Database.LogOnServerEX "ado", ODBC名, 数据库名,Uid,Pwd,,连接字串

以上这个应该可以用作连接SQLServer的了。
0755 2003-10-28
  • 打赏
  • 举报
回复
To 0211997 的兄弟:

你的方法是通过ODBC连接数据库吗?
liuxum 2003-10-27
  • 打赏
  • 举报
回复
参照这个:
Dim CryApp As New CRAXDDRT.Application

Dim moxAplication As CRAXDRT.Application

Dim moxData As CRAXDRT.DatabaseTable

Set moxAplication = New CRAXDRT.Application
Set moxReport = moxAplication.OpenReport("E:\jyc040e1.rpt")

Call moxReport.DiscardSavedData


Call moxReport.Database.Tables(2).SetLogOnInfo("aplite2", "", "ct00", "nec")
'***或者用下面的
' For Each moxData In moxReport.Database.Tables
' Call moxData.SetLogOnInfo("aplite2", "", "ct00", "nec")
' Next
'SQL
'moxReport.SQLQueryString = "select * from V_JYC040E"
'RANGE
'moxReport.RecordSelectionFormula = "{V_JYC040E111.ZYUCHUYMD}>=20011101 AND {V_JYC040E111.ZYUCHUYMD}<20011201"
'************************************

CRViewer1.ReportSource = moxReport
CRViewer1.ViewReport
CRViewer1.Zoom (100)
Set moxAplication = Nothing
rocllllll 2003-10-27
  • 打赏
  • 举报
回复
Crystal8.5中有一方法:
cryTrialReport.Database.LogOnServer "pdsodbc.dll", ODBC名, 数据库名,Uid,Pwd
在9.1肯定也有,加上应该就可以了
因为Crystal的报表的数据源是自成体系的(相对VB的数据源而言)
yeah33 2003-10-27
  • 打赏
  • 举报
回复
找不到SetLogOnInfo方法, 版本:crystal report9.2 、VB6

807

社区成员

发帖
与我相关
我的任务
社区描述
VB 多媒体
社区管理员
  • 多媒体
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧