急问:TQuery读取DBF文件出错
代码如下:
void __fastcall TForm1::FormCreate(TObject *Sender)
{
DBGrid1->DataSource = DataSource1;
DataSource1->DataSet = Query1;
Query1->DatabaseName = "E:\\DataBase";
Query1->Active = false;
Query1->SQL->Clear();
Query1->SQL->Add("select * from 表2.dbf");
Query1->ExecSQL();
Query1->Active = true;
}
编译运行后提示Table is busy,share violation.将VFP的dbf表换成SQL Server的db表就正常。请问这是什么原因啊?怎么解决呢?谢谢大家
[解决办法]
foxpro 的表 若没有设置为 share ,则同时只允许一个用户使用。
[解决办法]
void __fastcall TForm1::FormCreate(TObject *Sender)
{
DBGrid1->DataSource = DataSource1;
DataSource1->DataSet = Query1;
Query1->DatabaseName = "E:\\DataBase";
Query1->Active = false;
Query1->SQL->Clear();
Query1->SQL->Add("select * from 表2.dbf");
//Query1->ExecSQL();这句没用,可能会报错
Query1->Active = true;
}