Re: ADOX - Create new query in Access Database



You've used the wrong parameter for the Cat.Views.Append procedure
The second parameter should be an ADODB_TLB.Command, not a string;

See inserted/changed code below:

"Giuseppe Porzio" <giuseppe.porzio@xxxxxxx> wrote in message
news:44902444@xxxxxxxxxxxxxxxxxxxxxxxxx
Hello!

This is my question. I'm working with Delphi 6, ADO, MS Access 2000
Database.
I want create a new view (query) in Access database with ADOX library.
This
is my code:

...
dbName := sPathStampe + '\WorkReports.mdb';
DataSource := 'Provider=Microsoft.Jet.OLEDB.4.0' +
';Data Source=' + dbName +
';Persist Security Info=False';
Cat := CoCatalog.Create;
Cat.Set_ActiveConnection ( Datasource );

sSql := 'Select * from DatiPrv';
// insert code
cmd := ADODB_TLB.CoCommand.Create;
cmd.CommandType := cmdText;
cmd.CommantText := sSql;

Cat.Views.Append ('v_Prova', sSql );
// change to
Cat.Views.Append('v_Prova', cmd);
....

Compilator return error on sSql parameter of Append method (IDSpatch)

thaks

Giuseppe
Italy




.