CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2005
    Posts
    3

    Question 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

  2. #2
    Join Date
    Dec 2002
    Location
    London, UK
    Posts
    1,569

    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

    Code:
    DROP TABLE table
    And to select from one table to another use SELECT ... INTO, defined as:

    Code:
    SELECT field1[, field2[, ...]] INTO newtable [IN externaldatabase] FROM source
    Mike

  3. #3
    Join Date
    Sep 2002
    Location
    Mumbai
    Posts
    98

    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.
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured