I have the following codes in my report viewer.
However i'm just confuse why is it the the report doesn't display the right filtering.
Let say in this code, I would just like to filter out Such as student no..
I just added DataGrid in the form, fortunately its working fine.
Please I need your help guys. Am I writing my crystal report correct?
Thanks...
[code]
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Call LoadCrSingle(TextBox1.Text)
End Sub
Function LoadCrSingle(ByVal StudentNumber As String)
Dim CrDocument As ClaimStub 'name of crystal report
Dim DsetSingle As New dsStudents
Try
''Build a SQL statement to query the datasource
DsetSingle.Clear()
Dim SqlStr As String = "SELECT REQID, DOC_CODE, STUD_NO FROM Requests where Stud_No ='" & UCase(StudentNumber) & "'"
''Retrieve the data using the SQL statement
Dim Adapt = New OleDbCommand(SqlStr, sqlcon)
Dim da = New OleDbDataAdapter(Adapt)
''Create a instance of a Dataset
''of the table in the report.
da.Fill(DsetSingle, "Requests")
''Pass the dataset to the report
CrDocument = New ClaimStub 'make new fill dataset
CrDocument.Database.Tables(0).SetDataSource(DsetSingle)
''View the report
CRViewer.ReportSource = CrDocument
DataGrid1.DataSource = DsetSingle.REQUESTS
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, Me.Text)
End Try
End Function
[code]Open the file and in the menu File, uncheck the option Save Data with Reports
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment