怎么将ini文件的数据写入ACCESS数据库
ini 文件内容如下
[000001/1]
SIGN=XX
TagEngDesc=
pva=XXXX
UNIT=
MIN=111
MAX=22222
DecimalPoint=3
Text=123.123
[000001/2/4]
SIGN=XX
TagEngDesc=
pva=XXXX
UNIT=
MIN=000
MAX=1233
DecimalPoint=0
[000001/2]
SIGN=aaa
TagEngDesc=sadasd
pva=
UNIT=gg
MIN=12
MAX=23
DecimalPoint=4
Text=912.4567
...
...
...
欲将这些数据存在ACCESS的一个表里,格式如下:
ID 变量名 SIGN Desc pva pvb Unit MIN Max
1 000001/1 XX XXXX 11 222
2 000001/2/4 XX XXXX 000 1233
3 000001/2 aaa sadasd gg 12 23
.....
...
...
怎么做呢??请高手说仔细点。谢谢了。
[解决办法]
随手写了下,供参考:
TIniFile *aini=new TIniFile("e:\\temp\\t.ini");
TStringList *s=new TStringList();
String m_Section;
String m_SIGN;
String m_TagEngDesc;
String m_pva;
String m_UNIT;
String m_MIN;
String m_MAX;
String m_DecimalPoint;
String m_Text;
aini->ReadSections(s);
Memo1->Lines->AddStrings(s);
ADOTable1->Open();
// ADOTable1->DeleteRecords() ;
for(int i=0;i<s->Count;i++)
{
m_Section=s->Strings[i];
m_SIGN=aini->ReadString(m_Section,"SIGN","");
m_TagEngDesc=aini->ReadString(m_Section,"TagEngDesc","");
m_pva=aini->ReadString(m_Section,"pva","");
m_UNIT=aini->ReadString(m_Section,"UNIT","");
m_MIN=aini->ReadString(m_Section,"MIN","");
m_MAX=aini->ReadString(m_Section,"MAX","");
m_DecimalPoint=aini->ReadString(m_Section,"DecimalPoint","");
m_Text=aini->ReadString(m_Section,"Text","");
ADOTable1->AppendRecord(ARRAYOFCONST((i+1,m_Section,m_SIGN,m_TagEngDesc
,m_pva,m_UNIT,m_MIN,m_MAX,m_DecimalPoint,m_Text)));
}
ADOTable1->Close();
delete s;
delete aini;
[解决办法]
ADOTable:Missing TableName property
你的表名没有填,你要在access中先将表建好(程序中也可以建),然后将ADOTable的TableName设为你的表名