Report not accepting the condition
Hello,
I have createc view for two tables and I am trying to get report according to a condition(search by schoolid). The problem is, in the second query (denoted with '*****) is not retrieving the records accroding to the condition. It's simply retriecving all the record. Can anyone help me. Throug the query , in my xml file, I am geting the exact result. And I have tried to print Response.Write(Ds.Tables(0).Rows.Count), it's retrieving the exact number of rows, but the report viewer is displying wrong result.
Thanks
Ceema
crpt = New Admini
Dim cmd As New SqlCommand
Dim Da As New SqlDataAdapter
Dim Ds As New DataSet
Dim SchoolID As String
Dim ClassID As String
SchoolID = "Ab1"
ClassID = "1-A"
For Each myTable In crpt.Database.Tables
myLogin = myTable.LogOnInfo
myLogin.ConnectionInfo.ServerName = "IB"
myLogin.ConnectionInfo.DatabaseName = "FS"
myLogin.ConnectionInfo.Password = "1"
myLogin.ConnectionInfo.UserID = "sa"
myTable.ApplyLogOnInfo(myLogin)
Next
' **********get the result from view....>This is not checking the condition******************
SchoolID = "Ab0"
Dim Con As SqlConnection
Con = New SqlConnection("server=IB; uid=sa; pwd=1; database=FS")
Da = New SqlDataAdapter("Select * From vAdminDetailRpt where SchoolID= '" & SchoolID & "'", Con)
Da.Fill(Ds)
Me.CrystalReportViewer1.Visible = True
crpt.SetDataSource(Ds.Table(0))
CrystalReportViewer1.EnableDrillDown = False
CrystalReportViewer1.DisplayGroupTree = False
crpt.PrintOptions.PageMargins.topMargin.Equals(0)
CrystalReportViewer1.ReportSource = crpt
Ds.WriteXml("c:\backups\testfile.xml")
Con.Close()
Da.Dispose()
Ds.Dispose()
End Sub
|