CSDN博客

img liyux

Properties

发表于2004/9/28 11:19:00  626人阅读

设置属性

  1. 确定需要设置的属性。
  2. 确定属性所属的集合。
  3. 分配DBPROPSET结构类型的数组,每个单元为一个确定的属性集合。
  4. 为每个属性集合分配一个DBPROP结构类型数组。每个数组中单元的数量是在第一步中确定的属于本属性集的属性的数量。

Jet Provider 属性

DBPROPSET_JETOLEDB_DBINIT

DBPROP_JETOLEDB_ENGINE
Type: VT_I4
Typical R/W: R/W
Description: Jet OLEDB:Engine Type

详表定义了当前访问数据库/数据存储使用的存储引擎(the storage engine)。

常数:

JET_ENGINETYPE_UNKNOWN = 0
JET_ENGINETYPE_JET10 = 1
JET_ENGINETYPE_JET11 = 2
JET_ENGINETYPE_JET2X = 3
JET_ENGINETYPE_JET3X = 4
JET_ENGINETYPE_JET4X = 5
JET_ENGINETYPE_DBASE3 = 10
JET_ENGINETYPE_DBASE4 = 11
JET_ENGINETYPE_DBASE5 = 12
JET_ENGINETYPE_EXCEL30 = 20
JET_ENGINETYPE_EXCEL40 = 21
JET_ENGINETYPE_EXCEL50 = 22
JET_ENGINETYPE_EXCEL80 = 23
JET_ENGINETYPE_EXCEL90 =24
JET_ENGINETYPE_EXCHANGE4 = 30
JET_ENGINETYPE_LOTUSWK1 = 40
JET_ENGINETYPE_LOTUSWK3 = 41
JET_ENGINETYPE_LOTUSWK4 = 42
JET_ENGINETYPE_PARADOX3X = 50
JET_ENGINETYPE_PARADOX4X = 51
JET_ENGINETYPE_PARADOX5X = 52
JET_ENGINETYPE_PARADOX7X = 53
JET_ENGINETYPE_TEXT1X = 60
JET_ENGINETYPE_HTML1X = 70

当调用IDBDataSourceAdmin::CreateDataSource时,这个属性可用于为新数据库指定格式。

一旦数据库被打开,这个属性可确定打开文件的版本。

void PropertiesSet(IDBProperties *pIDBProperties)
{
 std::wcout << L"PropertiesSet ... " << std::endl;

 DBPROP rgJetProps[1];
 for (ULONG i = 0; i < 1; i++) {
  VariantInit(&rgJetProps[i].vValue);
  rgJetProps[i].dwOptions = DBPROPOPTIONS_REQUIRED;
 }
 rgJetProps[0].dwPropertyID = DBPROP_JETOLEDB_ENGINE;
 V_VT(&rgJetProps[0].vValue) = VT_I4;
 V_I4(&rgJetProps[0].vValue) = JETDBENGINETYPE_EXCEL90;

 DBPROPSET JetPropSet;
 JetPropSet.rgProperties = rgJetProps;
 JetPropSet.cProperties = 1;
 JetPropSet.guidPropertySet = DBPROPSET_JETOLEDB_DBINIT;

 pIDBProperties->SetProperties(1, &JetPropSet);
}

待续...

0 0

相关博文

我的热门文章

img
取 消
img