?
Solved

What database should I use?

Posted on 2000-04-03
9
Medium Priority
?
170 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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 200 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

770 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