ado方式查询access数据库问题
使用了四个控件:ADOTable,DataSource,Query,DBGrid。
我的桌面上有一个Database1.mdb的文件,ADOTable的ConnectionString为:Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Administrator\桌面\Database1.mdb;Persist Security Info=False,
TableName为shane。
当程序执行:
this->Query1->Close();
this->Query1->SQL->Clear();
AnsiString strSQL = "SELECT * FROM shane";
this->Query1->SQL->Text = strSQL;
this->Query1->Open();
会出现这样一个报错:
Exception class EDBEngineError with message 'Table does not exist.
File or directory does not exist.
File: C:\Documents and Settings\Administrator\My Documents\C++ Builder 2009\Projects\Debug\shane.DB
File: C:\Documents and Settings\Administrator\My Documents\C++ Builder 2009\Projects\Debug\shane.DBF
File: C:\Documents and Settings\Administrator\My Documents\C++ Builder 2009\Projects\Debug\shane.txt
File: C:\Documents and Settings\Administrator\My Documents\C++ Builder 2009\Projects\Debug\shane'.
[解决办法]
终于知道你怎么错了,唉,这句的问题,用strContractValue->Add(),
strContractValue->Strings[i] = pIniFile->ReadString("段名", strContract->String[i], "");