ActiveReports3 Request technical support
SQL Property
See Also  Example


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

Syntax

Visual Basic (Declaration) 
Public Property SQL As String
Visual Basic (Usage)Copy Code
Dim instance As SqlDBDataSource
Dim value As String
 
instance.SQL = value
 
value = instance.SQL
C# 
public string SQL {get; set;}

Example

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

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.

See Also