SqlContext.SqlText Property
.NET Standard 2.x
Gets the SQL text stored in SqlContext.
Namespace: PowerScript.Bridge
Assembly: PowerScript.Bridge.dll
Syntax
public string SqlText { get; }
Property Value
System.String
Returns the SQL text stored in SqlContext.
Examples
The following code example demonstrates how to use the SqlText
propertyto get the SQL statement defined in the SqlContext
object.
using System;
using PowerScript.Bridge;
namespace Appeon.ApiDoc.SqlContextExamples
{
public class SqlTextExample
{
private readonly SchoolContext _context;
public SqlTextExample(SchoolContext dataContext)
{
// Sets the data context
_context = dataContext;
}
public void Example()
{
// Defines the SQL SELECT statement.
var sql = @"select EnrollmentID, Grade from StudentGrade " +
"where StudentID = @StudentID and CourseID=@CourseID";
// Creates the SqlContext object.
var sqlContext = _context.CreateSqlContext(sql);
// Shows the SQL statement stored in the SqlText property.
Console.WriteLine($"SqlText = {sqlContext.SqlText}");
/*This code produces the following output:
SqlText = select EnrollmentID, Grade from StudentGrade where StudentID = @StudentID and CourseID=@CourseID
*/
}
}
}
Applies to
.NET Standard
2.x