提交 e1a8d758 编写于 作者: L liusaimei

dataShare相关使用说明文档示例代码ArxTs规范整改

Signed-off-by: Nliusaimei <liusaimei@huawei.com>
上级 5e80b054
...@@ -22,8 +22,9 @@ import DataShareResultSet from '@ohos.data.DataShareResultSet'; ...@@ -22,8 +22,9 @@ import DataShareResultSet from '@ohos.data.DataShareResultSet';
```ts ```ts
import dataShare from '@ohos.data.dataShare'; import dataShare from '@ohos.data.dataShare';
import dataSharePredicates from '@ohos.data.dataSharePredicates' import dataSharePredicates from '@ohos.data.dataSharePredicates'
import { BusinessError } from '@ohos.base'
let dataShareHelper; let dataShareHelper: dataShare.DataShareHelper;
let uri = ("datashare:///com.samples.datasharetest.DataShare"); let uri = ("datashare:///com.samples.datasharetest.DataShare");
await dataShare.createDataShareHelper(this.context, uri, (err, data) => { await dataShare.createDataShareHelper(this.context, uri, (err, data) => {
if (err != undefined) { if (err != undefined) {
...@@ -36,12 +37,12 @@ await dataShare.createDataShareHelper(this.context, uri, (err, data) => { ...@@ -36,12 +37,12 @@ await dataShare.createDataShareHelper(this.context, uri, (err, data) => {
let columns = ["*"]; let columns = ["*"];
let da = new dataSharePredicates.DataSharePredicates(); let da = new dataSharePredicates.DataSharePredicates();
let resultSet; let resultSet: DataShareResultSet;
da.equalTo("name", "ZhangSan"); da.equalTo("name", "ZhangSan");
dataShareHelper.query(uri, da, columns).then((data) => { dataShareHelper.query(uri, da, columns).then((data: DataShareResultSet) => {
console.info("query end, data : " + data); console.info("query end, data : " + data);
resultSet = data; resultSet = data;
}).catch((err) => { }).catch((err: BusinessError) => {
console.error("query fail, error message : " + err); console.error("query fail, error message : " + err);
}); });
``` ```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册