|
-
May 8th, 2002, 09:49 PM
#1
Database or Registry?
Sups,
I got this declarations:
VB Code:
Public Type CityType
Name as String
PName as String
HPay as Integer
Hotel as Integer
End Type
Dim Cities[1 to 15] as CityType
I need to save all of this data, all 15 cities.
My question is, where should i save it, on a database (I dont wanna use SQL, h8 it! ), or on registry.
That's alot of data, and if on registry, i wanna know how to remove it when uninstalling the app, so wacha think?
-
May 8th, 2002, 09:52 PM
#2
PowerPoster
I would suggest saving it to a file and then encrypting it if you don't want anybody else to see it.
Registry is mostly used to store a small number of properties for your application.
-
May 8th, 2002, 09:56 PM
#3
I was thinkin about this way, but its alot of data, plus i got, lets say, something like 3 users playin, which is 15*3 cities...
-
May 8th, 2002, 09:58 PM
#4
PowerPoster
It'll take almost same space as the registry and also it's gonna be pretty messy in the registery saving a lot of stuff. So you can either use a database file (eg .mdb) or simple ascii file as I said above.
-
May 8th, 2002, 10:00 PM
#5
K. Is there a way to remove the data from the registry?
-
May 8th, 2002, 10:05 PM
#6
Hyperactive Member
Re: Database or Registry?
Hi Stiletto,
Well..why u r not using ACESS 2000 as backend? Any problems?
Well..i don't know much about registry..but i think u can store this data in one single key in registry. for eg. u can store Hpay and ZHOtel as "DWORD" valuse in registry while Name and Pname will be stored as "String". And while unstalling the applicaton, u can delete that particular key from Registy.
Ayone pls. correct me if i'm wrong.
Anita
Can't imagine life without VB
(Various Boyfriends)
-
May 8th, 2002, 10:15 PM
#7
PowerPoster
There are lot of example on working with the registry on this forum.
One of them is
http://www.vbforums.com/showthread.p...e+registry+key
-
May 8th, 2002, 10:56 PM
#8
PowerPoster
Something like that is just begging to be stored in a txt file. I would not fool with a DB overhead for such a small amount of data. But then again it's too much for the registry.
Use a Txt file.
-We have enough youth. How about a fountain of "Smart"?
-If you can read this, thank a teacher....and since it's in English, thank a soldier.

-
May 9th, 2002, 12:51 AM
#9
Hyperactive Member
this might help you get started if you want to use a text file
VB Code:
Dim Cities(1 To 15) As CityType
Private Type CityType
Name As String
PName As String
HPay As Integer
Hotel As Integer
End Type
Private Sub Form_Load()
Dim i As Integer
For i = LBound(Cities) To UBound(Cities)
Let Cities(i).Name = "Name " & Str(i)
Let Cities(i).PName = "PName " & Str(i)
Let Cities(i).HPay = i
Let Cities(i).Hotel = i
Next i
End Sub
Private Sub Command1_Click()
Dim FF, i As Integer
Let FF = FreeFile
Open App.Path & "\cities.txt" For Append As #FF
For i = LBound(Cities) To UBound(Cities)
Print #FF, Cities(i).Name & "," & Cities(i).PName & "," & Str(Cities(i).HPay) & "," & Str(Cities(i).Hotel)
Next i
Close #FF
End Sub
Private Sub Command2_Click()
Dim strSplit() As String
Dim i As Integer
strSplit = Split(GetCityType(3, (App.Path & "\cities.txt")), ",")
For i = LBound(strSplit) To UBound(strSplit)
MsgBox strSplit(i)
Next i
End Sub
Private Function GetCityType(intCityToGet As Integer, strFileName As String) As String
Dim FF, i As Integer
Let FF = FreeFile
Let i = 1
Dim strName, strPName, strHPay, strHotel As String
Open strFileName For Input As #FF
Do While Not EOF(FF)
Input #FF, strName, strPName, strHPay, strHotel
If i = intCityToGet Then Exit Do
i = i + 1
Loop
Let GetCityType = strName & "," & strPName & "," & strHPay & "," & strHotel
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|