ISqlWhereBuilder.WhereIsNull(string left) Method
.NET Standard 2.x
Creates a WHERE clause, and adds a search condition to the WHERE clause. Uses IS NULL
operator to search for values that are null.
Namespace: SnapObjects.Data
Assembly: SnapObjects.Data.dll
Syntax
ISqlWhereAndOr WhereIsNull(string left);
Parameters
left
System.String
A SQL expression on the left of the IS NULL
operator.
Returns
SnapObjects.Data.ISqlWhereAndOr
Returns the ISqlWhereAndOr
object which can be used to add more search conditions to the current WHERE clause.
Examples
The following code example uses the WhereIsNotNull method to specify that data retrieved from the "Course" table must have a null value for Title.
using SnapObjects.Data;
using System;
namespace Appeon.ApiDoc.ISqlWhereBuilderExamples
{
public class WhereIsNullExample
{
private readonly SchoolContext _context;
public WhereIsNullExample(SchoolContext dataContext)
{
// Sets data context.
_context = dataContext;
}
public void Example()
{
// Declares SqlQueryBuilder.
var sqlbuilder = new SqlQueryBuilder();
// Defines a SQL statement, and sets the WhereIsNull condition: Title must be null.
sqlbuilder.Select("*")
.From("Course")
.WhereIsNull("Title");
string sql = sqlbuilder.ToSqlString(_context);
Console.WriteLine(sql);
/*This code produces the following output:
SELECT
*
FROM [Course]
WHERE ([Title] IS NULL)
*/
}
}
}
Applies to
.NET Standard
2.x