ActiveReports 6 Online Help
SQL Property (OleDBDataSource)
Example 

Specifies a valid SQL statement used to retrieve records from the data source.
Syntax
'Declaration
 
Public Property SQL As String
public string SQL {get; set;}
Remarks

ActiveReports creates a DataReader and uses it to load the data into the report.

The SQL string may contain parameter placeholder syntax to fill the report's parameters collection and prompt the user to enter their values before executing the report.

Example
private void detail_Format(object sender, System.EventArgs eArgs)
{    
    rptSub rpt = new rptSubBM();    
    DataDynamics.ActiveReports.DataSources.OleDBDataSource subDS = new DataDynamics.        
        ActiveReports.DataSources.OleDBDataSource();    
    subDS.ConnectionString = this.ds.ConnectionString;    
    subDS.SQL = "Select * from products where categoryID = " + m_categoryID;    
    rpt.DataSource = subDS;    
    ctlSubReport.Report = rpt;
}
Private Sub Detail1_Format(ByVal sender As Object, ByVal e As System.EventArgs) Handles Detail1.Format
    Dim rpt As New rptSubBM()
    Dim subDS As New DataDynamics.ActiveReports.DataSources.OleDBDataSource()    
    subDS.ConnectionString = Me.ds.ConnectionString    
    subDS.SQL = "Select * from products where categoryID = " + m_categoryID    rpt.DataSource = subDS    
    Me.ctlSubreport.Report = rpt 
End Sub
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

OleDBDataSource Class
OleDBDataSource Members
ParameterCollection Class
Parameter Class
Parameters Property

Send Feedback