这段代码出了什么问题! [英] What is wrong with this code!

查看:75
本文介绍了这段代码出了什么问题!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我使用以下代码检索我的报告。我正在使用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))< br> Ds.WriteXml(" c:\ backups \ testfile.xml")

CrystalReportViewer1.ReportSource = crpt

解决方案

< blockquote>


如果要为报表提供数据集,则无需提供登录代码,请尝试删除以下代码:


对于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 this

Thanks
Ceema

crpt = 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 SqlDataAdapter

myConnection = 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


这篇关于这段代码出了什么问题!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆