>Dear All,
>I want to filter record base on hostcode field, I ran below codes, but it does not work (I mean, seems like my sql command not working, all of records shown or not filtered)
>
> Public Sub New(ByVal pReportDocument As String)
> MyBase.New()
>
> 'This call is required by the Windows Form Designer.
> InitializeComponent()
>
> ''Create an instance of the strongly-typed report object
>
> 'declare an instance of the report and the connectionInfo object
>
> crReportDocument = New ReportDocument
> crConnectioninfo = New ConnectionInfo
>
> ''Build a connection string
> Dim connectionString As String = SQLConn0.ConnectionString
>
> ''Create and open a connection using the connection string
>
> adoSQLConn = New SqlClient.SqlConnection(connectionString)
>
> ''Build a SQL statement to query the datasource
> Dim sqlString As String = ""
> sqlString = "Select * From [1001005] where hostcode = '00015'"
>
> ''Retrieve the data using the SQL statement and existing connection
> adoDataAdapter = New SqlClient.SqlDataAdapter(sqlString, adoSQLConn)
>
> ''Create a instance of a Dataset
> DataSet = New DataSet
>
> ''Fill the dataset with the data retrieved. The name of the table
> ''in the dataset must be the same as the table name in the report.
> adoDataAdapter.Fill(dataSet, "1001005")
>
> crReportDocument.Load("..\" & pReportDocument)
>
> ''Pass the populated dataset to the report
> crReportDocument.SetDataSource(dataSet)
>
> ''Set the viewer to the report object to be previewed.
> CrystalReportViewer1.ReportSource = crReportDocument
>
> 'view the report
> CrystalReportViewer1.ShowCloseButton = False
> CrystalReportViewer1.DisplayGroupTree = pDisplayGroupTree
> CrystalReportViewer1.ShowGroupTreeButton = pDisplayGroupTree
> CrystalReportViewer1.ReportSource = crReportDocument
> Me.WindowState = FormWindowState.Maximized
> 'Add any initialization after the InitializeComponent() call
>
> End Sub
>
>Am I missing something? I need advice .. thanks a lot in advance
>
>Regards
>Winanjaya
Have you confirmed whether or not the DataSet contains the extra rows before setting the report's DataSource?
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only