请问如何把已经读入ADOQuery的数据集导出成visual foxpro 6.0的dbf格式呢?dbf表事先不存在,要在程序运行中创建.翻看了以前的一些帖子,还是不得要领,请各位不吝赐教,谢谢.顺便问一下如果dbf表结构事先已经存在,那要怎么搞?
解决方案 »
- MDI窗体背景问题,高手进,乞求救命也!!!
- 急求,读取字典控件
- adoquery 用insert插入,最前面的零不见了
- 动态创建报表中遇到的问题。
- 急求:如何开发能够在internet上跑的聊天室程序,
- 主从表结构中,主表和从表通过一id号关联,如果主表改变了原来已有记录的id号,那么从表的id号如何才能合理地更新为新的id号?
- 如何把sqlserver的表,转换成foxpro的dbf数据库?最好给我代码谢谢!
- COM事件使用中的参数个数问题,急死人啦,快来看看>>>>>>>>>
- 怎样获得socket连接的序号?
- 最小化问题?
- D7中的TcpClient组件和TcpServer组件于D6中的ServerSocket组件有什么区别呢?
- 绝对有挑战性的问题:两个线程,中的insert和update语句完全一样,会出现问题吗?
Table_DBF.TableName := '..\Export\qqtel.dbf';
Table_DBF.TableType := ttFoxPro;
try
Table_DBF.Active:=True;
if not Table_DBF.eof then
begin
Table_DBF.Close;
Table_DBF.EmptyTable;
Table_DBF.Open;
end;
except
Table_DBF.Close;
Application.MessageBox('数据库错误','错误', MB_OK+MB_ICONERROR);
exit;
end;
QueryCustomer.First;
while not QueryCustomer.Eof do
begin
//插入DBF文件
try
Table_DBF.Append;
Table_DBF.FieldValues['tele'] := QueryCustomer.FieldByName('telephone').AsString;
Table_DBF.Post;
except
Table_DBF.Close;
exit;
end;
QueryCustomer.Next;
end;
Table_DBF.Close;
对于dbf事先不存在的情况我还有个疑问,我小改了一个delphi自带的在程序运行时建表的例子:
with Table1 do begin
Active := False;
\\DatabaseName := 'DBDEMOS';
TableType := ttFoxPro;
TableName := 'a.dbf'; { Don't overwrite an existing table } if not Table1.Exists then begin
{ The Table component must not be active }
{ First, describe the type of table and give }
{ it a name }
{ Next, describe the fields in the table }
with FieldDefs do begin
Clear;
with AddFieldDef do begin
Name := 'Field1';
DataType := ftInteger;
Required := True;<===========这个Required属性,设为false则可以正常建表,而设成True则提示表结构invalid,异常退出.
end;
with AddFieldDef do begin Name := 'Field2';
DataType := ftString;
Size := 30;
end;
end;
{ Next, describe any indexes }
with IndexDefs do begin
Clear;
with AddIndexDef do begin Name := 'Fld2Indx';
Fields := 'Field2';
Options := [ixCaseInsensitive];
end;
end;
{ Call the CreateTable method to create the table }
CreateTable;
end;
end;把其中AddFieldDef的Required属性设为false可以正常建表,而设为true则提示表结构非法,异常退出.这是怎么回事呢?该怎么办?谢谢