SqlBuilder.Update(string table, string schema) Method
.NET Standard 2.x | Current Version (1.0.1) 
Creates an ISqlUpdateBuilder object for building a SQL UPDATE statement, and specifies the name and schema of the table or view from which the rows are to be updated.
Namespace: SnapObjects.Data
Assembly: SnapObjects.Data.dll
Syntax
public static ISqlUpdateBuilder Update(string table, string schema);
Parameters
table System.String
The name of the table or view from which the rows are to be updated.
schema System.String
The name of the schema to which the table or view belongs.
Returns
SnapObjects.Data.ISqlUpdateBuilder
Returns a newly created ISqlUpdateBuilder object which can be used to build the SQL UPDATE statement.
Examples
The following code example demonstrates how to use the Update(string table, string schema) method.It updates the Name value to "Chinese" for the record where DepartmentID = 1 in the "Department" table and specifies a schema for the "Department" table.
using SnapObjects.Data;
using System;
namespace Appeon.ApiDoc.SqlBuilderExamples
{
public class UpdateExample
{
private SchoolContext _context;
public UpdateExample(SchoolContext dataContext)
{
// Sets Data Context.
_context = dataContext;
}
public void Example2()
{
// Modifies the Name value to "Chinese" for the record where DepartmentID=1 in the "Department" table.
// Specifies "dbo" as the schema for the "Department" table.
var query = SqlBuilder
.Update("Department", "dbo")
.SetValue("Name", "Chinese")
.Where("DepartmentID", "1");
// 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:
UPDATE [dbo].[Department] SET [Name] = N'Chinese'
WHERE ([DepartmentID] = 1)
*/
}
}
}
Applies to
.NET Standard
2.x