Results 1 to 5 of 5

Thread: Create New database at runtime

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2004
    Location
    india
    Posts
    2

    Question Create New database at runtime

    Hi,
    Is it possible to create a new database at the runtime?
    If yes how and if not why?
    Thanks

  2. #2
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877

    Re: Create New database at runtime

    Originally posted by junk
    Hi,
    Is it possible to create a new database at the runtime?
    If yes how and if not why?
    Thanks
    Search for ADOX you will find many examples here..

    http://www.vbforums.com/search.php?s...ost&sortorder=
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  3. #3
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    VB Code:
    1. 'Add a reference to Microsoft ADO Ext. X.X For DLL And Security
    2.  
    3. Option Explicit
    4. Dim cat As ADOX.Catalog
    5. Dim tbl As ADOX.Table
    6.  
    7. Private Sub Command1_Click()
    8.     Set cat = New ADOX.Catalog
    9.     Set tbl = New ADOX.Table
    10.  
    11.     ' create the db
    12.     cat.Create "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\newDB3.mdb"
    13.    
    14.     With tbl
    15.       .Name = "TestTable"
    16.       ' Create fields and append them to the
    17.       ' Columns collection of the new Table object.
    18.       With .Columns
    19.          .Append "ID COLUMN"
    20.          .Append "SetName", adVarWChar, 255
    21.          .Append "SetVal", adVarWChar, 255
    22.          .Append "Description", adVarWChar, 255
    23.       End With
    24.    End With
    25.    
    26.    ' Add the new Table to the Tables collection of the database.
    27.    cat.Tables.Append tbl
    28.    
    29.    'Set AllowZeroLength to true for the SetName field
    30.    tbl.Columns("SetName").Properties("Jet OLEDB:Allow Zero Length") = True
    31.    
    32.    Set cat = Nothing
    33.    Set tbl = Nothing
    34.    
    35. End Sub

    and yes.. you would proabaly find this when searcing
    -= a peet post =-

  4. #4
    Member
    Join Date
    Sep 2002
    Location
    Cordova, TN
    Posts
    60
    Just out of curiosity (and because of the project i'm working on as my semeser project for school) would this work in vb.net 2003? If not, how would i create a new access database in vb.net 2003? Oh yeah, i found this thread by searching
    How come it's a penny for your thoughts, but you have to put your 2 cents in? Somebody's makin' a penny

  5. #5
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    Hi IceBreakerG,
    this will NOT work in VB .Net.

    You will have to use ADO .NET

    Ask the question in the VB .NET forum, I'm suer some of the good people in that forum knows how to do this.

    http://www.vbforums.com/forumdisplay.php?s=&forumid=25
    -= a peet post =-

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