SqlBuilder.WhereIsNotNull(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 NOT NULL
operator to search for values that are not null.
Namespace: SnapObjects.Data
Assembly: SnapObjects.Data.dll
Syntax
public static ISqlWhereCondition WhereIsNotNull(string left);
Parameters
left
System.String
A SQL expression on the left of the IS NOT 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 WhereIsNotNull method to determine whether the specified field in the current table is null, and returns the data which is not null to a model.
using SnapObjects.Data;
using System;
namespace Appeon.ApiDoc.SqlBuilderExamples
{
public class WhereIsNotNullExample
{
private SchoolContext _context;
public WhereIsNotNullExample(SchoolContext dataContext)
{
// Sets Data Context.
_context = dataContext;
}
public void Example()
{
var sqlquerybuilder = new SqlQueryBuilder();
// Defines a WHERE condition.
var where = SqlBuilder.WhereIsNotNull("Title");
// Creates a SQL statement.
var query = sqlquerybuilder
.Select("*")
.From("Course")
.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 [Course]
WHERE ([Title] IS NOT NULL)
*/
}
}
}
Applies to
.NET Standard
2.x