在vb.net中的crystal report中绑定xml时无法加载数据库信息 [英] Failed to load database information while binding xml in crystal report in vb.net
问题描述
请帮助我 我正在使用Vs 2005和水晶报告11.5当我运行设置并尝试查看下面的Crystal报告错误来吧。当运行时这个代码在我的机器上,当我运行安装程序并尝试查看报告然后错误来运行时它工作正常。我使用XML来结合数据和晶体报告。该代码就像这样 ds.WriteXml(Application.StartupPath& " \Reports\AverageAnalysis.xml" ) ds.WriteXmlSchema(Application.StartupPath& " \Reports\AverageAnalysisSchema.xsd" ) '################################## ################################################## ##### crReportDocument.Load(Application.StartupPath&
并且Develpoer机器中没有错误当我安装设置时在客户端然后错误进入报告,绑定水晶与xml.And在另一个报告中,ado.net连接将正常工作。
请帮助我
没能广告数据库信息
文件错误:"C:\doument\..\\ ... .rpt")
请帮助它非常紧急
代码就像
私人 功能 GenerateReport() 如 布尔
Dim ds,subDs As New DataSet
< font color ="#0000ff"size = 2> Dim strSql As 字符串
Dim pvCollection As 新 ParameterValues
昏暗 pdv As 新 ParameterDiscreteValue
Dim crtableLogoninfos As 新 TableLogOnInfos
Dim crtableLogoninfo As 新 TableLogOnInfo
Dim crConnectionInfo As New ConnectionInfo
Dim CrTables As Tables
Dim CrTable 作为 表
Dim sqladpt As SqlDataAdapter
Dim strConnection As 字符串
如果 con.State = ConnectionState.Open 那么 con.Close()
strConnection =
" server = 192.3; Database = BM123; User Id = sa; Password = dewe"con.ConnectionString = strConnection
con.Open()
尝试
GenerateReport =
FalsestrSql =
" SPAvgAnalysisDatewiseLocWise'" & txtLocationCode.Text.Trim& "','" & _txtTradeCode.Text.Trim&
"','" &格式(dtpFromDate.Value, " yyyy / MM / dd" )& "','" & _格式(dtpToDate.Value,
" yyyy / MM / dd" )& "','S','','','APP'"sqladpt =
新 SqlDataAdapter(strSql,con)sqladpt.Fill(ds)
'############## ################################################## ########################
< font color ="#008000"size = 2>'生成报告我们需要xml数据和模式文件,生成报告后
'无需创建这些文件,我们可以直接将数据集绑定到报告
如果 不 ds 没什么 T母鸡
If ds .Tables(0).Rows.Count = 0 然后
MessageBox .Show(
"抱歉没有数据......" )返回 False
结束 如果
ds.WriteXml(Application.StartupPath&
" \Reports\AverageAnalysis.xml" )ds .WriteXmlSchema(Application.StartupPath&
" \Reports\AverageAnalysisSchema.xsd" )'########################## ################################################## #############
crReportDocument.Load(Application.StartupPath&
" \Reports\rptAverageAnalysis.rpt" )'使用crConnectionInfo
'。ServerName =" 192.168.29.152"
'.DatabaseName =" BMS"
" .UserID =" sa"
'。Password =" gitman"
'以结尾
'CrTables = crReportDocument.Database.Tables
'对于CrTables中的每个CrTable
'crtableLogoninfo = CrTable.LogOnInfo
'crtableLogoninfo.ConnectionInfo = crConnectionInfo
'CrTable.ApplyLogOnInfo(crtableLogoninfo)
'Next
Else
MessageBox.Show(
"抱歉无数据......" )返回 False
End If
GenerateReport =
TrueCatch ex As Exception
MessageBox.Show(ex.ToString)
GenerateReport =
False最后
如果 不 ds 没什么 然后 ds.Dispose()
如果 不 subDs 没什么 然后 subDs.Dispose()
结束 试试
结束 功能
私人 Sub cmdPreView_Click( ByVal sender As System.Object, ByVal e As System.EventArgs) 句柄 cmdPreView.Click
If GenerateReport()= True 然后
Dim rpt As 新 frmReportWindow
rpt.Text =
" Average Analysis"rpt.crViewer.ReportSource = crReportDocument
rpt.crViewer.DisplayGroupTree =
Falserpt.crViewer。缩放(1)
rpt.Show()
End If
结束 Sub
你好
这不是Crystal Reports问题的正确形式。这个表格是d iscuss code performance&使用VSTS中的高级开发工具进行安全性,包括静态和动态分析,代码分析和单元测试。
您应该检查 http://msdn.microsoft.com/newsgroups/ 为您的问题找到正确的新闻组。
谢谢
Brian [MSFT]
Microsoft Developer Support
这个帖子是"原样"提供的。没有保证,也没有授予任何权利。
pls help me
I am using Vs 2005 and crystal report 11.5 when i run the set up and try to view the Crystal report below error Come .when run this code in my machine it works fine when i run the setup and try view the report then error come. I AM USING XML FOR BINDING DATA WITH CRYSTAL REPORTS. THE CODE IS LIKE THIS ds.WriteXml(Application.StartupPath & "\Reports\AverageAnalysis.xml") ds.WriteXmlSchema(Application.StartupPath &
crReportDocument.Load(Application.StartupPath &
"\Reports\rptAverageAnalysis.rpt")And Error doesnot come in Develpoer machine When i install the setup in th client then error come in the report that bind crystal with xml.And in Another report that having ado.net connection will works fine.
pls help me
failed to load database information
error in file:"C:\doument\..\\... .rpt")
pls help its very urgent
code is like
Private Function GenerateReport() As Boolean
Dim ds, subDs As New DataSet Dim strSql As String Dim pvCollection As New ParameterValues Dim pdv As New ParameterDiscreteValue Dim crtableLogoninfos As New TableLogOnInfos Dim crtableLogoninfo As New TableLogOnInfo Dim crConnectionInfo As New ConnectionInfo Dim CrTables As Tables Dim CrTable As Table Dim sqladpt As SqlDataAdapter Dim strConnection As String If con.State = ConnectionState.Open Then con.Close()strConnection =
"server=192.3;Database=BM123;User Id=sa;Password=dewe"con.ConnectionString = strConnection
'ReadXML()con.Open()
TryGenerateReport =
FalsestrSql =
"SPAvgAnalysisDatewiseLocWise '" & txtLocationCode.Text.Trim & "','" & _txtTradeCode.Text.Trim &
"','" & Format(dtpFromDate.Value, "yyyy/MM/dd") & "','" & _Format(dtpToDate.Value,
"yyyy/MM/dd") & "','S','','','APP'"sqladpt =
New SqlDataAdapter(strSql, con)sqladpt.Fill(ds)
'######################################################################################## 'to generate the report we need xml data and schema file, once the report is generated 'no need to create these files , we can directly bind the dataset to report If Not ds Is Nothing Then If ds.Tables(0).Rows.Count = 0 ThenMessageBox.Show(
"Sorry No Data...") Return False End Ifds.WriteXml(Application.StartupPath &
"\Reports\AverageAnalysis.xml")ds.WriteXmlSchema(Application.StartupPath &
"\Reports\AverageAnalysisSchema.xsd") '#########################################################################################crReportDocument.Load(Application.StartupPath &
"\Reports\rptAverageAnalysis.rpt") 'With crConnectionInfo ' .ServerName = "192.168.29.152" ' .DatabaseName = "BMS" ' .UserID = "sa" ' .Password = "gitman" 'End With 'CrTables = crReportDocument.Database.Tables 'For Each CrTable In CrTables ' crtableLogoninfo = CrTable.LogOnInfo ' crtableLogoninfo.ConnectionInfo = crConnectionInfo ' CrTable.ApplyLogOnInfo(crtableLogoninfo) 'Next ElseMessageBox.Show(
"Sorry No Data...") Return False End IfGenerateReport =
True Catch ex As ExceptionMessageBox.Show(ex.ToString)
GenerateReport =
False Finally If Not ds Is Nothing Then ds.Dispose() If Not subDs Is Nothing Then subDs.Dispose() End Try End Function Private Sub cmdPreView_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdPreView.Click If GenerateReport() = True Then Dim rpt As New frmReportWindowrpt.Text =
"Average Analysis"rpt.crViewer.ReportSource = crReportDocument
rpt.crViewer.DisplayGroupTree =
Falserpt.crViewer.Zoom(1)
rpt.Show()
End If End SubHello
This is not the correct form for Crystal Reports questions. This form is to discuss code performance & security using the advanced development tools in VSTS including static and dynamic analysis, code profiling, and unit testing.You should check http://msdn.microsoft.com/newsgroups/ to find the correct newsgroup for your issue.
Thanks
Brian [MSFT]
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights.
这篇关于在vb.net中的crystal report中绑定xml时无法加载数据库信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!