Solved

What database should I use?

Posted on 2000-04-03
9
166 Views
Last Modified: 2011-09-20
I want to create a database to contain strings.  I originally was going to create a multidemensional array, but I decided that the capabilities given to the database types (SQL, record.movenext, etc.) would be very useful.  
I didn't really want to rely on the fact that the cooputer had Access or Excel. How would I create and edit a simple database in my VB application?
0
Comment
Question by:cocor
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 1

Expert Comment

by:tkuppinen
ID: 2681503
Have you given any thought to putting thee strings into a text file?  Much quicker and less overhead than using a database.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2681537
You should consider using a MDB database (free to distribute - doesn't require Access) with DAO database access method. If you use ADO, you will have to distribute MDAC_TYP.EXE which is about 6.5meg to distribute!
0
 

Author Comment

by:cocor
ID: 2681632
The strings will have a varying amount of descriptors.  Therefore, i would have primary key, name, and then 5-10 more descriptors (each descriptor is a string)each.  A text file would be me searching overhead.

So a DAO database doesn't not require Access, therefore I could use the following code and I will be creating a virtual database while my program is running?


Dim MyVirutalDB As Database
Set MyVirutalDB = OpenDatabase("c:\MyVirutalDB.mdb")

Is this using the Microsoft Jet DB?
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

Author Comment

by:cocor
ID: 2681645
The strings will have a varying amount of descriptors.  Therefore, i would have primary key, name, and then 5-10 more descriptors (each descriptor is a string)each.  A text file would be me searching overhead.

So a DAO database doesn't not require Access, therefore I could use the following code and I will be creating a virtual database while my program is running?


Dim MyVirutalDB As Database
Set MyVirutalDB = OpenDatabase("c:\MyVirutalDB.mdb")

Is this using the Microsoft Jet DB?
0
 
LVL 6

Expert Comment

by:Marine
ID: 2681745
No this will not do it. You would need to reference Dao.Then use tableDefs object to Create A Database. Your code would just establish connection to an already exisiting database. i'll post a link in a few.
0
 
LVL 6

Accepted Solution

by:
Marine earned 50 total points
ID: 2681758
Here is some code.
Sub NewDatabase()
    Dim wspDefault As Workspace, dbs As Database
    Dim tdf As TableDef, fld1 As Field, fld2 As Field
    Dim idx As Index, fldIndex As Field

    Set wspDefault = DBEngine.Workspaces(0)
    ' Create new, encrypted database.
    Set dbs = wspDefault.CreateDatabase("Newdb.mdb", _
        dbLangGeneral, dbEncrypt)
    ' Create new table with two fields.
    Set tdf = dbs.CreateTableDef("Contacts")
    Set fld1 = tdf.CreateField("ContactID", dbLong)
    fld1.Attributes = fld1.Attributes + dbAutoIncrField
    Set fld2 = tdf.CreateField("ContactName", dbText, 50)
    ' Append fields.
    tdf.Fields.Append fld1
    tdf.Fields.Append fld2
    ' Create primary key index.
    Set idx = tdf.CreateIndex("PrimaryKey")
    Set fldIndex = idx.CreateField("ContactID", dbLong)
    ' Append index fields.
    idx.Fields.Append fldIndex
    ' Set Primary property.
    idx.Primary = True
    ' Append index.
    tdf.Indexes.Append idx
    ' Append TableDef object.
    dbs.TableDefs.Append tdf
    dbs.TableDefs.Refresh
    Set dbs = Nothing
End Sub

Ofcourse you will be needing additonal code to populate the fields and the search though them. This code just creates a datbase and tables. Also fields, sets primary key. Here isthe link.

http://msdn.microsoft.com/library/devprods/vs6/vbasic/dao360/dt_damthCreateDatabaseX.htm
0
 

Author Comment

by:cocor
ID: 2681879
So this is used by adding the DAO 3.60 Reference Object Library.
What if I only have a selection of 2.5/3.5, 3.0, or 3.51 when I go to Project->References in my workspace.  What is the difference?
0
 

Author Comment

by:cocor
ID: 2681893
Marine, I will be excepting your answer.  I just wanted to know what type of reference object would be best for this solution
0
 
LVL 6

Expert Comment

by:Marine
ID: 2681992
I would suggest referencing 3.6 because its the latest for DAO. Good Luck.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question