|
-
Apr 7th, 2000, 02:48 AM
#1
Thread Starter
Hyperactive Member
I am wondering can you store lots of strings in the registry wittout causing any problems? Like for instance (I know i can use INI or Database but lets just say) you had a list of 40 usernames could you store all of these usernames in the Registry without having it crash or errors like crazy? My next question is I am just learning database programming is there a way to search a database without having to load it into like a list box then have it look at the first word in the list box and if it isn't what you are looking for then go on to the next listindex and so forth till it gets to the end. I hope you understand what I mean maybe this will help ex database.search = "hello" then it looks for hello and if it finds it then it says it does and if not then it says no. or whatever very simple example. thanks!!
-
Apr 7th, 2000, 04:04 AM
#2
Addicted Member
First Question:
Yes you can store multiple entries into the Registry, but I wouldn't recomend it, especially when the number could drastically change. Instead, if you want to store multiple entries where they're are the same basic value (eg. Username) and store the same basic data and data type, then you should look into storing them as a Multi SZ string. What's a Multi SZ string? A Multi SZ string is a Registry data-type which is basically one string that contains multiple strings within it. Each string element within the whole string is/should be separated by a NULL character and the entire string should be terminated with two NULL characters. When you want to put a Multi SZ string into the value in the Registry use the Join function to bring all the string together, for example:
Code:
sMultiSZ = Join(asUserNames, vbNullChar)
sMultiSZ = sMultiSZ & vbNullChar
When you want to retrieve the data use the following to get the strings out of the Multi SZ string:
Code:
Dim asUserNames() As String
asUserNames = Split(sMultiSZ, vbNullChar)
If asUserNames(UBound(asUserNames)) = vbNullString Then
ReDim Preserve asUserNames(UBound(asUserNames) - 1)
End If
Second Question
Look into SQL (Structured Query Language)!
PS
Also for the first quesion, I was under the assumption that you know how to send and retrieve values from the Registry. If you don't just let me know and I'll post it, but you should try searching this site and MSDN first, they can probably explain it better. Later.
[Edited by SonGouki on 04-07-2000 at 05:09 PM]
-
Apr 7th, 2000, 05:32 AM
#3
Thread Starter
Hyperactive Member
First Question:
Umm I understood what the Multi SZ can do but I am not getting this code for it. Yes I know how to read and delete and read from registry savesettings and so forth. Could you maybe explain the code a little bit more thank!!!!
Second:
I have heard of SQL before. Umm I have no idea how to do it is there like a program like VB 6.0 that you need to do it in and if so then how much? and can you intertwine sql and vb6 because my program does a lot with what it gets from the database so I don't know if SQL can actually do these things so then I would need vb but maybe they can work together. Any ideas where to get SQL or learn it or whetver it is.
Thanks!!!
-
Apr 8th, 2000, 10:55 AM
#4
Addicted Member
First Question:
What more do you want me to explain? You write the single Multi SZ string to the registry and you read it from the registry as a single string. Maybe if I explain the variables? asUserNames is an array of all your user names, one user name per element. sMultiSZ is a single string of all the user names concatenated together with NULL characters as the delimiter, this is string is that you write and retrieve from/to the registry. What else do you want me to elaborate?
Second Question:
Look into the ADO control for VB6. However, you should probably look into it further before trying to use it, the concept is probably to deep for you to just figure out.
There is LOTS of info out there on SQL, and how to intigrate it with VB. Search the web or go to your local computer book store. There is a fairly comprehensive start to using SQL with VB on this site, just look for it from the home page.
Good Luck!
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
|