本文介绍了这段代码出了什么问题!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 您好, 我使用以下代码检索我的报告。我正在使用Asp.net(版本1.1)& sql 2000& Crystal Reports 9.我的查询正在检索xml文件的确切结果,但是Crystal报表没有检索到确切的结果,它没有采用查询的条件,它简单地显示了表中的所有teh recrds。能帮我解决这个问题 谢谢 Ceema crpt = New BlueRegisterEnglish 'crpt = New Form1A '************ Dim cmd As New SqlCommand Dim Da As New SqlDataAdapter Dim Ds As New DataSet Dim SchoolID作为字符串 SchoolID =" AB0" Dim ClassID As String ClassID =" 1-A" 对于crpt.Database.Tables中的每个myTable myLogin.ConnectionInfo.ServerName =" IBA" myLogin.ConnectionInfo.DatabaseName =" School" myLogin.ConnectionInfo.Password =" 1239" myLogin.ConnectionInfo.UserID =" sa" myTable.ApplyLogOnInfo(myLogin) '******** Dim myConnection As SqlConnection Dim mySqlDataAdapter As SqlDataAdapter myConnection = New SqlConnection("server = IBA; uid = sa; pwd = 1239; database = School") Da = New SqlDataAdapter(" Select * From tmpblueregister Where SchoolID ='"& SchoolID&" ;'和class ='"& ClassID&"'",myConnection) Da.Fill(Ds,"TmpForm1A"") crpt.SetDataSource(Ds.Tables(0)) Ds.WriteXml(" c:\ backups \ testfile.xml") CrystalReportViewer1.ReportSource = crpt 解决方案 如果要为报表提供数据集,则无需提供登录代码,请尝试删除以下代码: 对于crpt.Database.Tables中的每个myTable myLogin.ConnectionInfo.ServerName =" IBA" myLogin.ConnectionInfo.DatabaseName =" School" myLogin.ConnectionInfo.Password =" 1239" myLogin.ConnectionInfo.UserID =" sa" myTable.ApplyLogOnInfo(myLogin)下一步 看看是否有帮助 Hello,I am using the following code to retrieve my report. I am using Asp.net(version 1.1) & sql 2000 & Crystal Reports 9. My query is retrieving exact result to the xml file, but crystal report is not retrieving the exact result, it's not taking the condition of the query, it simpy shows all teh recrds in the table. Can you please help me to solve thisThanks Ceemacrpt = New BlueRegisterEnglish'crpt = New Form1A '************ Dim cmd As New SqlCommand Dim Da As New SqlDataAdapter Dim Ds As New DataSet Dim SchoolID As String SchoolID = "AB0" Dim ClassID As String ClassID = "1-A"For Each myTable In crpt.Database.Tables myLogin = myTable.LogOnInfo myLogin.ConnectionInfo.ServerName = "IBA" myLogin.ConnectionInfo.DatabaseName = "School" myLogin.ConnectionInfo.Password = "1239" myLogin.ConnectionInfo.UserID = "sa" myTable.ApplyLogOnInfo(myLogin) Next '******** Dim myConnection As SqlConnection Dim mySqlDataAdapter As SqlDataAdaptermyConnection = New SqlConnection("server=IBA; uid=sa; pwd=1239; database=School") Da = New SqlDataAdapter("Select * From tmpblueregister Where SchoolID = '" & SchoolID & "' and class= '" & ClassID & "'", myConnection) Da.Fill(Ds, "TmpForm1A") crpt.SetDataSource(Ds.Tables(0)) Ds.WriteXml("c:\backups\testfile.xml") CrystalReportViewer1.ReportSource = crpt 解决方案 Hi,you don't need to provide logon code if you are supplying the report with a dataset, try removing the following code:For Each myTable In crpt.Database.Tables myLogin = myTable.LogOnInfo myLogin.ConnectionInfo.ServerName = "IBA" myLogin.ConnectionInfo.DatabaseName = "School" myLogin.ConnectionInfo.Password = "1239" myLogin.ConnectionInfo.UserID = "sa" myTable.ApplyLogOnInfo(myLogin) Next see if that helps 这篇关于这段代码出了什么问题!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 07-21 01:10