Updates
To write data back to a data service using a data source object, use the write method on the data source.
To check for service provider support for writing data, use the allow.write attribute on the DataSource object servicing the query request. Visit the data source service provider documentation for details on support for writing data.

Writing Data

The following sends two users to the data service to be persisted in the Users table in a relational database using the WireBootstrap Query Service as identified by the table parameter in the data source constructor. An option specifies the key on the entity. Options are provider specific. This option is used by the query service to determine whether to insert or update each record.
1
const accountService = new wire.data.DataSource("sql", {
2
Provider: {
3
Server: "query-server"
4
}
5
});
6
7
const users = [
8
{UserName: "jkratz", Active: true},
9
{UserName: "pdougherty", Active: false},
10
]
11
12
const options = {
13
Keys: ["name"]
14
}
15
16
const newrows = accountService.write("Users", users, options);
Copied!
Visit WireBootstrap Query Service for more on the query service.
Copy link
Contents
Writing Data