Problem with create table ADOComand - field integer

Hi guys,

{Use Delphi XE7 VCL}

I want create one dbf table with ADOConnection and ADOCommand.

This is my code:

{code}
ADOConnection1.connectionstring := 'Provider=MSDASQL.1;Persist Security Info=False;Data Source=dBASE Files;Extended Properties=dBase IV;Mode=ReadWrite;Initial Catalog= ' + myPath;
ADOConnection1.LoginPrompt      := false;
ADOConnection1.connected         := true;

ADOCommand1.Connection      := ADOConnection1;
ADOCommand1.CommandText := 'Create table test.dbf ( [id] integer, [name] varchar(20) )';
ADOCommand1.execute;
{code}

The 'test.dbf' file is created, but the 'id' field is created with type numeric(20,5).
I tried to use 'numeric(10,0)' on field definition type and i get error: "Syntax error in the instruction CREATE TABLE"


But, if to use:
{code}
ADOConnection1.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0; Data Source=' + myPath  + '; Extended Properties=dBASE IV;Mode=ReadWrite';
ADOConnection1.LoginPrompt      := false;
ADOConnection1.connected         := true;

ADOCommand1.Connection      := ADOConnection1;
ADOCommand1.CommandText := 'Create table test.dbf ( [id] numeric[10,0], [name] varchar(20) )';
ADOCommand1.execute;
{code}
The error not appears, but don't works. The field type continue with numeric(20,5).

Some one help me?
0
Maycoll
5/29/2015 5:11:35 PM
embarcadero.delphi.ado 597 articles. 1 followers. Follow

0 Replies
815 Views

Similar Articles

[PageSpeed] 58

Reply: