//试验程序
void __fastcall TForm1::Button1Click(TObject *Sender)
{
int i; //TDateTime dt;
int array[14*2]={3,5,7,12,31,40,220,4,8,9,14,50,45,110,3,5,7,12,31,40,220,4,8,9,14,50,45,110};
DataModule1->Table1->EmptyTable();//这两句好想有问题?
DataModule1->Table1->Active=true;
for(i=0;i<4;i++)
{
DataModule1->Table1->Insert();
DataModule1->Table1->FieldByName("序号")->AsInteger=i+1;
//dt=EncodeDate(Word(array[i*7]), Word(array[i*7+1]), Word(array[i*7+2]));
DataModule1->Table1->FieldByName("日期")->AsString=IntToStr(array[i*7])+"-"+IntToStr(array[i*7+1])+"-"+IntToStr(array[i*7+2]);
DataModule1->Table1->FieldByName("时间")->AsString=IntToStr(array[i*7+3])+":"+IntToStr(array[i*7+4])+":"+IntToStr(array[i*7+5]);
DataModule1->Table1->FieldByName("数值")->AsInteger=array[i*7+6];
DataModule1->Table1->Post();
}
}
按第一次Button1的时候没有问题,但是第二次按Button1的时候就提示表打不开:Table cannot opened for exclusive use.
Why? Why? Why?
--------------------next---------------------
阅读(1192) | 评论(0) | 转发(0) |