PDA

View Full Version : Databases in HB?


N1c0_ds
05-05-2007, 06:27 PM
Hello again! I didn't want to hijack my previous thread so here's my new HB++ question:

I have a list of strings (over 400 different strings) that I want to access randomly.

My current config is the following:

Public Sub Generate()
Randomize
Dim n As Integer
n=(20 - 0 + 1) * Rnd() + 0

If n=0 Then Field1.Text = "..."
If n=1 Then Field1.Text = "..."
If n=2 Then Field1.Text = "..."
If n=3 Then Field1.Text = "..."
If n=4 Then Field1.Text = "..."
If n=5 Then Field1.Text = "..."
If n=6 Then Field1.Text = "..."
If n=7 Then Field1.Text = "..."
If n=8 Then Field1.Text = "..."
If n=9 Then Field1.Text = "..."
If n=10 Then Field1.Text = "..."
If n=11 Then Field1.Text = "..."
If n=12 Then Field1.Text = "..."
If n=13 Then Field1.Text = "..."
If n=14 Then Field1.Text = "..."
If n=15 Then Field1.Text = "..."
If n=16 Then Field1.Text = "..."
If n=17 Then Field1.Text = "..."
If n=18 Then Field1.Text = "..."
If n=19 Then Field1.Text = "..."
If n=20 Then Field1.Text = "..."
If n=21 Then Field1.Text = "..."
If n=22 Then Field1.Text = "..."
If n=23 Then Field1.Text = "..."
If n=24 Then Field1.Text = "..."
If n=25 Then Field1.Text = "..."
If n=26 Then Field1.Text = "..."
If n=27 Then Field1.Text = "..."
If n=28 Then Field1.Text = "..."
If n=29 Then Field1.Text = "..."

But since I have well over 400 of those "...", I get error 4008, and I need 'to put these strings in a database and access them dynamically at runtime' according to the manual.

Here's my question: How do I, with HB 1.04, put these strings in a database (external if possible) and access them randomly considering the StringList function is not available in this version?

Please answer quickly, thanks in advance!
Nico

alt236
05-06-2007, 11:42 AM
Have a look at his thread here: http://www.handheld-basic.com/forum/viewtopic.php?t=798

Create an access database that contains an index field and a data field.
Use the utility provided in the above thread and then convert the db into a hb++ table.
Open the table and access the data inside.
Its not the fastest way of doing it but if you are using 1.04 I can't think of another way.

It might be better if you post in the hb++ forums.

medicalmarvel
05-06-2007, 04:38 PM
sorry, peeped into the wrong thread..