Results 1 to 3 of 3

Thread: Creating tables in ADO

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Location
    Perth, WA, Australia
    Posts
    6

    Post

    I swear blind I cannot find how to do this from the MSDN.

    >Okay, I've managed to create a table as per Clunietp:

    Dim strConnectionStringOfNewDB As String
    Dim objCat As ADOX.Catalog

    Set objCat = New ADOX.Catalog
    strConnectionStringOfNewDB = "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=C:\db.mdb"
    objCat.Create strConnectionStringOfNewDB

    Set objCat = Nothing

    >Now I try to create a table:

    cCN.Provider = "Microsoft.Jet.OLEDB.3.51;"
    cCN.Properties("Data Source") = "c:\db.mdb"
    cCN.Open

    Set cRS = cCN.Execute("CREATE TABLE tblint (anumber TEXT atype TEXT);")

    >but it falls over on the SQL!
    What am I doing wrong? Perhaps I should have started this app in DAO, but I've come so far I can't let ADO beat me now!

    Thanks

    CYOCONNOR

  2. #2
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    why don't you use the code Chris posted here: http://www.vb-world.net/forums/showt...0&pagenumber=2 ??

    Anyways, using your method, where are your connection and recordset objects defined? Why are you trying to return a recordset from a CREATE TABLE statement?

    To get your way to work, change this line:

    CREATE TABLE tblint (anumber TEXT atype TEXT)

    To this:

    CREATE TABLE tblint (anumber TEXT, atype TEXT)

    You forgot the comma.

    HTH

    Tom

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Location
    Perth, WA, Australia
    Posts
    6

    Post

    Thanks for the help, yet again, Clunietp.
    <b>
    why don't you use the code Chris posted here: http://www.vb-world.net/forums/showthread.php?threadid=10720&pagenumber=2 ??
    </B>
    Because the subject header related to setting database passwords, not creating tables, as did the first few posts, which meant I just skipped over it when searching.

    I searched the whole forum for answers to this question. Mustn't be searching hard enough!

    CYOCONNOR

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