Board index » delphi » Add a new Table to a MDB Database

Add a new Table to a MDB Database

What is the way to add a new table to an Acces DataBase using ADO ?

and

What is the way to define the fields, indexes to the new table?

Thanks

--
Alejandro Castro
www.alfra.info
alejan...@alfra.info

 

Re:Add a new Table to a MDB Database


Quote
"Alejandro Castro" <alejan...@alfra.info> wrote in message

3eeb620...@newsgroups.borland.com

Quote
> What is the way to add a new table to an Acces DataBase using ADO ?

[...]

Quote
> What is the way to define the fields, indexes to the new table?

You can use either ADOX or SQL DDL.

--

 A: Top-posters.
 Q: What is the most annoying thing on Usenet?

Re:Add a new Table to a MDB Database


Hi Alejandro,

 It is very easy to create a table in Access using an ADOQuery component.
The syntax is simple and here is an example:

  Create table table_name (fieldname1 fielddefinition1, ...fieldnameN
fielddefinitionN).

  create table CUSTOMER (customerid integer, [last name] varchar(30), [first
name] varchar(30))

An index can be created like this:

  create unique index CUSTOMERIDX on customer(customerid)

The syntax is not case-sensitive and of course use the 'UNIQUE' qualifier
only where appropriate.
Note that tablenames or fieldnames that have embedded spaces must be
enclosed by [] as tihs is a requirement of Access.

Regards,

Michael

Quote
"DRS" <d...@removethis.ihug.com.au> wrote in message

news:3eeb7a37@newsgroups.borland.com...
Quote
> "Alejandro Castro" <alejan...@alfra.info> wrote in message
> 3eeb620...@newsgroups.borland.com
> > What is the way to add a new table to an Acces DataBase using ADO ?

> [...]

> > What is the way to define the fields, indexes to the new table?

> You can use either ADOX or SQL DDL.

> --

>  A: Top-posters.
>  Q: What is the most annoying thing on Usenet?

Re:Add a new Table to a MDB Database


Quote
>> What is the way to define the fields, indexes to the new table?

>You can use either ADOX or SQL DDL.

I think, ADOX could be the prefered way, because MS Access sets a
stupid flag for string fields by default, when using DDL.
I talk about the flag "allow empty strings".

cu Christian

Other Threads