Delete & Create Access Table
Hi everyone!!
I would like to know how could I delete and create Tables in an Access DataBase from a vb.Net code. I've tried to use the SQL statement 'DROP' and 'CREATE' but I wasn't able to get it.
By the way, somebody knows how to fill an Access table with a data created with a selection from another Access table??
Thanks in advance
Re: Delete & Create Access Table
CREATE and DROP should work... Access uses the Microsoft Jet SQL and the create statement is defined as:
Code:
CREATE TABLE table (
field1 type [(size)] [NOT NULL] [index1]
[, field2 type [(size)] [NOT NULL] [index2]
[, ...]]
[, CONSTRAINT multifieldindex [, ...]])
so, something like:
CREATE TABLE TMyTable
(ID INT,
Name VARCHAR (50)
)
shoulde work?!?
Snap with drop
And to select from one table to another use SELECT ... INTO, defined as:
Code:
SELECT field1[, field2[, ...]] INTO newtable [IN externaldatabase] FROM source
1 Attachment(s)
Re: Delete & Create Access Table
Check the datatyps in the SQL Queries as Varchar in SQL is Text in Access. May be that can be the problem, if so see the differences in both in attached files.