SqlBuilder.WhereIsNull(string left) Method
.NET Standard 2.x
Creates an ISqlWhereCondition
object which represents a search condition that can be used when building the WHERE clause. Uses IS NULL
operator to search for values that are null.
Namespace: SnapObjects.Data
Assembly: SnapObjects.Data.dll
Syntax
public static ISqlWhereCondition WhereIsNull(string left);
Parameters
left
System.String
A SQL expression on the left of the IS NULL
operator.
Returns
SnapObjects.Data.ISqlWhereCondition
Returns the ISqlWhereCondition
object which can be used to add more search conditions to the WHERE clause.
Examples
The following code example demonstrates how to use the WhereIsNull
method to retrieve records which has null values for the specified field.
using SnapObjects.Data;
using System;
namespace Appeon.ApiDoc.SqlBuilderExamples
{
public class WhereIsNullExample
{
private SchoolContext _context;
public WhereIsNullExample(SchoolContext dataContext)
{
// Sets Data Context.
_context = dataContext;
}
public void Example()
{
var sqlquerybuilder = new SqlQueryBuilder();
// Defines a subquery.
var where = SqlBuilder.WhereIsNull("HireDate");
// Creates a SQL statement.
var query = sqlquerybuilder
.Select("*")
.From("Person")
.Where(where);
// Converts to raw SQL for the database corresponding to the data context.
string sql = query.ToSqlString(_context);
Console.WriteLine(sql);
/*This code example produces the following output:
SELECT
*
FROM [Person]
WHERE ([HireDate] IS NULL)
*/
}
}
}
Applies to
.NET Standard
2.x