ISqlWhereBuilder.WhereIsNotNull(string left) Method
.NET Standard 2.x
Creates a WHERE clause, and adds a search condition to the WHERE clause. Uses IS NOT NULL
operator to search for values that are not null.
Namespace: SnapObjects.Data
Assembly: SnapObjects.Data.dll
Syntax
ISqlWhereAndOr WhereIsNotNull(string left);
Parameters
left
System.String
A SQL expression on the left of the IS NOT 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 not null value for Title.
using SnapObjects.Data;
using System;
namespace Appeon.ApiDoc.ISqlWhereBuilderExamples
{
public class WhereIsNotNullExample
{
private readonly SchoolContext _context;
public WhereIsNotNullExample(SchoolContext dataContext)
{
// Sets data context.
_context = dataContext;
}
public void Example()
{
// Declares SqlQueryBuilder.
var sqlbuilder = new SqlQueryBuilder();
// Defines a SQL statement, and sets the WhereIsNotNull condition: Title cannot be null.
sqlbuilder.Select("*")
.From("Course")
.WhereIsNotNull("Title");
string sql = sqlbuilder.ToSqlString(_context);
Console.WriteLine(sql);
/*This code produces the following output:
SELECT
*
FROM [Course]
WHERE ([Title] IS NOT NULL)
*/
}
}
}
Applies to
.NET Standard
2.x