I cant' seem to get the following code to work
I am using VB/VS2005 and the problem is no matter what I get 100 of the data from the datatable. I checked the dataset and it is correct. It's like it's ignoring any parameters I try to pass to the report. As you can see it also didn't work when I tried to set the recordselection property.HTML Code:Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim myRe As New Reconciled() 'myRe.RecordSelectionFormula = "{Register.CLIENT} = 'AMG'" GetRecords("AMG") myRe.setdatasource(ds) CrystalReportViewer1.ReportSource = myRe End Sub Public Sub GetRecords(ByVal client As String) ds.Clear() Dim conn As New SqlClient.SqlConnection("xxxxx") Dim daComm As New SqlClient.SqlCommand("Select * from register where client = '" & client & "'", conn) Dim daSelect As New SqlClient.SqlDataAdapter(daComm) Try conn.Open() daSelect.Fill(ds, "register") conn.Close() Catch ex As Exception MessageBox.Show(ex.ToString, "error", MessageBoxButtons.OK) End Try End Sub




Reply With Quote