if not Table1.Exists then begin with Table1 do begin { The Table component must not be active } Active := False; { First, describe the type of table and give } { it a name } DatabaseName := 'dbase'; TableType := ttFoxpro; TableName := 'CustInfo'; { Next, describe the fields in the table } with FieldDefs do begin Clear; with AddFieldDef do begin Name := 'Field1'; DataType := ftInteger; Required := True; end; with AddFieldDef do begin Name := 'total'; DataType := ftfloat; Required := True; end; with AddFieldDef do begin Name := 'Field2'; DataType := ftString; Size := 30; end; end; { Next, describe any indexes } with IndexDefs do begin Clear; { The 1st index has no name because it is { a Paradox primary key } with AddIndexDef do begin Name := 'Fldidx1'; Fields := 'Field1'; Options := [ixPrimary]; end; with AddIndexDef do begin Name := 'Fld2Indx'; Fields := 'Field2'; Options := [ixCaseInsensitive]; end; end; { Call the CreateTable method to create the table } CreateTable; end; end;
select into [foxpro 6.0;Database=d:\MyDatabase].[abc.dbf] from [SourceTableName]
ADOQuery1.Close; ADOQuery1.SQL.Clear; ADOQuery1.SQL.Add ('select into [foxpro 6.0;Database=d:\temp].[abc.dbf] from test '); ADOQuery1.ExecSQL ; 出错! PARAMETER对象被不正确的定义。提供了不一至或不完整的信息
如果你能通过,请写出全部的PAS文件:)包括ADO的CONNECTIONSTRING
procedure TForm1.Button1Click(Sender: TObject);
var
DBPath: String;
begin
DBPath:='e:\dfwtest\test7';//你的数据库路径目录;
ADOConnection1.ConnectionString:='Provider=MSDASQL.1;'
+'Persist Security Info=False;'
+'Extended Properties='
+'"Driver={Microsoft Visual FoxPro Driver};'
+'UID=;'
+'SourceDB='+ DBPath + ';'
+'SourceType=DBF;'
+'Exclusive=No;'
+'BackgroundFetch=Yes;'
+'Collate=Machine;'
+'Null=Yes;'
+'Deleted=Yes;"';
AdoConnection1.Open;
AdoQuery1.Sql.Text := 'create table "aaa.dbf" (aaa char(2))';
//AdoQuery1.Sql.Text := 'create table "ddd.dbf" (aaa char(2)),fff float(3),eee numeric (4,1),torf boolean ,rdate date)';
AdoQuery1.ExecSql;
end;
//ado打开dbf
procedure TForm1.Button3Click(Sender: TObject);
var
DBPath: String;
begin
DBPath:='e:\dfwtest\test7';//你的数据库路径;
ADOConnection1.ConnectionString:='Provider=MSDASQL.1;'
+'Persist Security Info=False;'
+'Extended Properties='
+'"Driver={Microsoft Visual FoxPro Driver};'
+'UID=;'
+'SourceDB='+ DBPath + ';'
+'SourceType=DBF;'
+'Exclusive=No;'
+'BackgroundFetch=Yes;'
+'Collate=Machine;'
+'Null=Yes;'
+'Deleted=Yes;"';
AdoQuery1.close;
AdoQuery1.sql.clear;
AdoQuery1.sql.Text := 'select * from ddd.dbf';
adoquery1.Open;
end;
with Table1 do begin
{ The Table component must not be active }
Active := False;
{ First, describe the type of table and give }
{ it a name }
DatabaseName := 'dbase';
TableType := ttFoxpro;
TableName := 'CustInfo';
{ Next, describe the fields in the table }
with FieldDefs do begin
Clear;
with AddFieldDef do begin
Name := 'Field1';
DataType := ftInteger;
Required := True;
end;
with AddFieldDef do begin
Name := 'total';
DataType := ftfloat;
Required := True;
end;
with AddFieldDef do begin
Name := 'Field2';
DataType := ftString;
Size := 30;
end;
end;
{ Next, describe any indexes }
with IndexDefs do begin
Clear;
{ The 1st index has no name because it is
{ a Paradox primary key }
with AddIndexDef do begin
Name := 'Fldidx1';
Fields := 'Field1';
Options := [ixPrimary];
end;
with AddIndexDef do begin
Name := 'Fld2Indx';
Fields := 'Field2';
Options := [ixCaseInsensitive];
end;
end;
{ Call the CreateTable method to create the table }
CreateTable;
end;
end;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add ('select into [foxpro 6.0;Database=d:\temp].[abc.dbf] from test ');
ADOQuery1.ExecSQL ;
出错!
PARAMETER对象被不正确的定义。提供了不一至或不完整的信息
+'Persist Security Info=False;'
+'Extended Properties='
+'"Driver={Microsoft Visual FoxPro Driver};'
+'UID=;'
+'SourceDB='+ DBPath + ';'
+'SourceType=DBF;'
+'Exclusive=No;'
+'Location=clUseClient'
+'BackgroundFetch=no;'
+'Collate=Machine;'
+'Null=Yes;'
+'Deleted=Yes;"';
不对
+ 'd:\zbzkdata\dmdata;'
+'SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;'
+'Collate=Machine;Null=Yes;Deleted=yes;'
这个CONNECTION也一样报错
建DBF用Create table "path\filename"