Results 1 to 29 of 29

Thread: Create new database ?[Resolved]

  1. #1

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

    Create new database ?[Resolved]

    with code ? How , where can I start off ?
    Last edited by Pirate; Jun 28th, 2003 at 11:21 AM.

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    How about start by compacting those 3 posts into 1.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by Cander
    How about start by compacting those 3 posts into 1.
    Each one is separate question with different solutions ? right ?

  4. #4

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    I did some search , I found out that I should use old ADO methods , Does this mean ADO.NET Can't do this ? Correct me if I'm wrong ! I hope so .

  5. #5
    Lively Member
    Join Date
    Jan 2003
    Posts
    69
    A sql Or Access database?

    I can ask someone

  6. #6

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    MS Access Database . Thank you cgj

  7. #7
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    Do you know the structure of the database? or do you want to create it at runtime through user input?
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

  8. #8

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by Memnoch1207
    Do you know the structure of the database? or do you want to create it at runtime through user input?
    I don't know the structure . All what I want to do is create it at runtime . Can you help plz?

  9. #9
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    This might help you out.
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

  10. #10
    Lively Member
    Join Date
    Jan 2003
    Posts
    69
    Memnoch1207 thanks
    It's For Sql

  11. #11

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    It's for SQL unfortunately . . I should have said I'm working on MS Access . Thanks Memnoch1207 .

  12. #12
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    try this link pirate it's very good
    ADO in .net explained the easy way
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  13. #13
    Lively Member
    Join Date
    Jan 2003
    Posts
    69
    Hi dynamic_sysop Thanks for the post
    That article has nothing about creating a database from code,

  14. #14

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    dynamic_sysop , I appreciate your help but I really need to create new database file . I know how to do different stuff on the data though . I'm frustrated by now .

  15. #15
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    I don't think there is a .NET way to create a new Access database. If you are in a real jam you can use the ADOX COM (VB6) way or I had a workaround for ya. You could keep a completely blank Access database in a .NET resource file and extract it out at runtime to create a new database. I think you can use the SchemaTable setup that I showed you about before to add tables and fields once you get the database itself.

    I'm not sure if you can add fields and tables via the Schema or not just a guess. I think you can for xml files but I'm not sure on Access databases.
    Last edited by Edneeis; Jun 28th, 2003 at 12:04 AM.

  16. #16

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Yeah , I thought that too . ADO.NET still leak this . Damn MS . They can't do everything perfect . . Edneeis you are really brilliant . I liked your idea . Definitely I'll try it out *but* before that what do you think of this solution :
    I'll use ADOX and write that code in VB6 . Make a dll or just convert the module file to .NET . I know this is interoper. but eh . I donno .

  17. #17

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    and btw I can't remember SchemaTable thingy ...lol . If you can help me with the other two posts , I'll be grateful . Damn , it doesn't seem my day . Hell of bugs , errors , problems ...lol .

  18. #18
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Using ADOX is definately easier and since .NET requires MDAC 2.7 it shouldn't be a problem you'll just need to add a reference to it in your .NET project (which creates the .NET wrapper for it). Here is how to do it with ADOX.

    http://www.freevbcode.com/ShowCode.Asp?ID=3315

    You don't even need to make a VB6 dll or use VB6 code. The .NET version using ADOX shouldn't be much different.

  19. #19

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    only two lines . . I hope they work for me . I'm dead tired now . I need to sleep . I'll look into it .

    Thanks Edy .

    Good night or whatever ....lol

  20. #20
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Yeah only 2 lines. Although I changed the link so check it again tomorrow. Good luck and good night.

  21. #21

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    You are VB.NET Forum leader .

  22. #22
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    You are VB.NET Forum leader .
    And although i have not seen (and may never see) him in person, I really beleive he is a real nice man. I have learned a lot from him. Thanks Edneeis.
    Last edited by Lunatic3; Jun 28th, 2003 at 04:01 PM.
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  23. #23
    Lively Member
    Join Date
    Jan 2003
    Posts
    69
    Thanks Edneeis

    Pirate I am still waiting for a reply form a .net expert,
    I will post ASAP

  24. #24

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by cgj
    Pirate I am still waiting for a reply form a .net expert,
    I will post ASAP
    Thank you cgi . That's very kind of you . I can wait

  25. #25
    Lively Member
    Join Date
    Jan 2003
    Posts
    69
    Microsoft article about ADOX and .net

    http://support.microsoft.com/default...en-us%3B317867

  26. #26

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    And that's what I'm using right now . It's ADOX-based . Still unmanaged code . What I really wanted is pure ADO.NET way but that's apparently for SQL Server db . Thanks anyways for the link .

  27. #27
    Member
    Join Date
    Jul 2003
    Posts
    58
    Tried this example and works great, but how can I add more tables in it?

    I tried This, but doesn't work for some reason.


    ADOXtable.Name = "Addressbook",
    ADOXtable.Columns.Append("Firstname1", ADOX.DataTypeEnum.adVarWChar, 50)
    ADOXtable.Columns.Append("Middlename1", ADOX.DataTypeEnum.adVarWChar, 50)
    ADOXtable.Columns.Append("Lastname1",

    ADOXcatalog.Tables.Append(ADOXtable)

    ADOXtable.Name = "Addressbook2",
    ADOXtable.Columns.Append("Firstname2", ADOX.DataTypeEnum.adVarWChar, 50)
    ADOXtable.Columns.Append("Middlename2", ADOX.DataTypeEnum.adVarWChar, 50)
    ADOXtable.Columns.Append("Lastname2",

    ADOXcatalog.Tables.Append(ADOXtable)

    ADOXtable = Nothing
    ADOXindex = Nothing
    ADOXcatalog = Nothing

    Thanks for your help...

  28. #28
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    You should probably start a new thread, I think a lot of people aren't going to look here since it is marked as resolved. BUT it might have something to do with reuseing the same instance of the Table. Try initializing it to a New table before adding the second one.
    VB Code:
    1. ADOXtable.Name = "Addressbook",
    2. ADOXtable.Columns.Append("Firstname1", ADOX.DataTypeEnum.adVarWChar, 50)
    3. ADOXtable.Columns.Append("Middlename1", ADOX.DataTypeEnum.adVarWChar, 50)
    4. ADOXtable.Columns.Append("Lastname1",
    5.  
    6. ADOXcatalog.Tables.Append(ADOXtable)
    7.  
    8. ADOXTable=New ADOX.ADOXTable
    9.  
    10. ADOXtable.Name = "Addressbook2",
    11. ADOXtable.Columns.Append("Firstname2", ADOX.DataTypeEnum.adVarWChar, 50)
    12. ADOXtable.Columns.Append("Middlename2", ADOX.DataTypeEnum.adVarWChar, 50)
    13. ADOXtable.Columns.Append("Lastname2",
    14.  
    15. ADOXcatalog.Tables.Append(ADOXtable)

    I didn't test this code or anything and I'm not sure what the actual object name is for the ADOX Table but you should get the idea.

  29. #29

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

    dude , don't dig up old threads just to ask your question ...


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