diff --git a/zh-cn/application-dev/database/share-data-by-datashareextensionability.md b/zh-cn/application-dev/database/share-data-by-datashareextensionability.md index 4cf921a9dd064debe3736a52fd7ebc5e3a59c662..0a344286a5295e078d620acd500c5e13221b4be0 100644 --- a/zh-cn/application-dev/database/share-data-by-datashareextensionability.md +++ b/zh-cn/application-dev/database/share-data-by-datashareextensionability.md @@ -62,7 +62,6 @@ ```ts import Extension from '@ohos.application.DataShareExtensionAbility'; - import rdb from '@ohos.data.relationalStore'; import dataSharePredicates from '@ohos.data.dataSharePredicates'; import relationalStore from '@ohos.data.relationalStore'; import Want from '@ohos.app.ability.Want'; @@ -86,9 +85,9 @@ onCreate(want: Want, callback: Function) { result = this.context.cacheDir + '/datashare.txt'; // 业务实现使用RDB - rdb.getRdbStore(this.context, { + relationalStore.getRdbStore(this.context, { name: DB_NAME, - securityLevel: rdb.SecurityLevel.S1 + securityLevel: relationalStore.SecurityLevel.S1 }, (err, data) => { rdbStore = data; rdbStore.executeSql(DDL_TBL_CREATE, [], (err) => { @@ -220,7 +219,7 @@ 4. 获取到接口类对象后,便可利用其提供的接口访问提供方提供的服务,如进行数据的增删改查等。 - ```ts + ```ts // 构建一条数据 let key1 = 'name'; let key2 = 'age'; diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-dataShareExtensionAbility.md b/zh-cn/application-dev/reference/apis/js-apis-application-dataShareExtensionAbility.md index 1b403d543e33d1a2da4b783ae1f8f560fc4ee424..ae21d12824c4638f112b6fbe86aef0d9fc99cc8f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-dataShareExtensionAbility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-dataShareExtensionAbility.md @@ -55,7 +55,7 @@ let rdbStore: relationalStore.RdbStore; export default class DataShareExtAbility extends DataShareExtensionAbility { onCreate(want: Want, callback: Function) { - relationalStore.getRdbStore(globalThis.getContext(), { + relationalStore.getRdbStore(this.context, { name: DB_NAME, securityLevel: relationalStore.SecurityLevel.S1 }, (err, data) => {