ActiveReports 8
SQL Property
See Also  Example
GrapeCity.ActiveReports.v8 Assembly > GrapeCity.ActiveReports.Data Namespace > SqlDBDataSource Class : SQL Property

Glossary Item Box

Specifies a valid SQL statement used to retrieve records from the data source.

Syntax

Visual Basic (Declaration) 
Public Property SQL As System.String
C# 
public System.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

C#Copy Code
Private void rpt_ReportStart(object sender, System.EventArgs eArgs)
{
    ((GrapeCity.ActiveReports.Data.OleDBDataSource)(this.DataSource)).ConnectionString = @"Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=AdventureWorks2000;Data Source=TESTING";
    ((GrapeCity.ActiveReports.Data.OleDBDataSource)(this.DataSource)).CommandTimeout = 30;
    System.IO.StringReader sr = new System.IO.StringReader(new System.IO.StreamReader("..\\..\\sqlString.txt").ReadToEnd());
    ((GrapeCity.ActiveReports.Data.OleDBDataSource)(this.DataSource)).SQL = sr.ReadToEnd();
    sr.Close();
}
Visual BasicCopy Code
Private Sub rpt_ReportStart(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.ReportStart
    CType(Me.DataSource, GrapeCity.ActiveReports.Data.OleDBDataSource).CommandTimeout = 30
    CType(Me.DataSource, GrapeCity.ActiveReports.Data.OleDBDataSource).ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=AdventureWorks2000;Data Source=TESTING"
    Dim sr As New System.IO.StringReader(New System.IO.StreamReader("..\\..\\sqlString.txt").ReadToEnd())
    CType(Me.DataSource, GrapeCity.ActiveReports.Data.OleDBDataSource).SQL = sr.ReadToEnd
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