Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 12 of 12
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Posts
    317
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Create Database Within ASP

    hi,
    As I know, we can use ASP code for creating Database instead of manually create the database, how about modify the database structure, for instance, I want to add one more column in table A, please advice! I'm USING ACCESS.

    Is there any reference??

    Please advice.

  • #2
    Regular Coder
    Join Date
    May 2002
    Location
    London, England
    Posts
    367
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This is the wrong forum for that topic, and should have been placed in the ASP forum. Please make sure that you place them in the right categories, that's what they are there for !

    I'll move this one for you
    Jeewhizz - MySQL Moderator
    http://www.sitehq.co.uk
    PHP and MySQL Hosting

  • #3
    Regular Coder
    Join Date
    Jul 2002
    Location
    The sunny side of the Alps
    Posts
    230
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi!

    You can create a table using SQL statement:
    Code:
    CREATE TABLE table_name
    (
    column_name1 data_type,
    column_name2 data_type,
    .......
    )
    Bostjan

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Read some of the more recent posts, there is definitely a couple of examples of code you can use.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #5
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Charon/others,

    I recently coded a web-db-management tool for an application i was helping on.

    It does more a less the same as the acces design-view pages (for the tables and variables). Creating tables, variables, indexes, primary keys, modifying them, creating view on these tables, displaying and updating data from tables ... The "only" things you can't do with it or renaming tables and creating multi-field indexes. Build for a micro$oft (access) database.

    If you're interested in it, send me a private message with your mail-address. (I can't put it uphere, cause i don't have it with me + need to include some instructions on it + don't want to set it free yet)

    On the other hand, if you have access, check out the helpfiles, on jet sql data definition language.
    It's always better to know how do do it yourself, so you can integrate it in your apps

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yeah I usually just type in whatever SQL statement I want, and that's it. No fancy interface.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #7
    Regular Coder
    Join Date
    Jun 2002
    Posts
    317
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Not support!!

    hi,

    But as note in the access help file, the Microsoft Jet database engine does not support the use of CREATE TABLE, or any of the DDL statements, with non-Microsoft Jet database engine databases.

    So, how??
    Please advice. Thanks so much!

  • #8
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Not support!!

    Originally posted by charon
    hi,

    But as note in the access help file, the Microsoft Jet database engine does not support the use of CREATE TABLE, or any of the DDL statements, with non-Microsoft Jet database engine databases.

    So, how??
    Please advice. Thanks so much!
    You have to use something other than Access.

  • #9
    Regular Coder
    Join Date
    Jul 2002
    Location
    The sunny side of the Alps
    Posts
    230
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm using
    Code:
    strconn = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("../baze/tajnistvo.mdb") 
    set conn = server.createobject("adodb.connection")
    conn.open strconn,"",""
    
    and then in SQL:
    CREATE TABLE table_name
    (
    column_name1 data_type,
    column_name2 data_type,
    .......
    )
    and it works in Access

    Bostjan

  • #10
    Regular Coder
    Join Date
    Jun 2002
    Location
    Northern NJ
    Posts
    404
    Thanks
    0
    Thanked 1 Time in 1 Post
    I am using...

    aConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=E:\myserv\myservaddra\mydatabase.mdb"

    ...as a connection string...

    Set connList = server.createobject("ADODB.Connection")
    connList.ConnectionString = aConnectionString
    connList.open

    ...to make the server object and...

    SQLmkTbl = "CREATE TABLE "& courseName &" (First_Name VARCHAR(20), Last_Name VARCHAR(30), Company VARCHAR(60)"

    ...to create a table in the database where courseName is an ASP variable and this works in access
    I would rather be a lion for a day than a lamb that lives forever.

  • #11
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    charon,

    a more general answer to your question:
    Micro$oft has his own SQL version (JetSQL) which differs very slightly from the standerd ANSI SQL.
    Differences: some extra datatypes + use of wildcard is a bit different.

    The Access helpfunction contains some sections on these limited differences.

    So you can always use the sql-statements and change them a little bit to be ansi compliant (verry slight changes)
    Of course, you will loose some functionalitys.

    Depending on which database you use, you will always loose out on some functionalitys that other databases have ...
    (And some databases have there 'privilidged' scripting languages, like the combination MySQL and PHP)

    But thats life, and knowing which databases supplies the best functionalitys for a project and being able to work with it and its privilidged scripting languageą is what distinguishes good allround coders from the rookies


    edit:
    reread your pos: thought you used access?, and this is a Jet engine database.
    If you want' to use another database, you nedd to use a different driver (one for each db-format). Even SQL Server uses a differnt driver. The string to use for this drivers can be easily found (searching this forum or an searchengine)
    Last edited by raf; 01-31-2003 at 08:04 AM.

  • #12
    Regular Coder
    Join Date
    Jun 2002
    Posts
    317
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks so much for the reply....
    can it support others any of the DDL statements, like alter, drop..etc???


  •  

    Posting Permissions

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