Box 24

 Home   Infos   Tipps   Webmail   Humor   Polizei   Gästebuch   Downloads   Chat   Suchen   Feedback   Links 

 

 Anmelden/Login   Neuanmeldung/New User   Java Telnet Applet   Telnet   
 

Sub SetUserVariable()

(since 5.4.449.5)

Sub SetUserVariable(section as string, key as string, value as XXXX)

This command will save the value as a key in section in the user's extended database. This function is basically the same as SetUserProfile(key,value) with section="profile".

Value can be the following type:

value as boolean
value as integer
value as string

To read the section and key, use the user record field called Variable as so:

dim s as string  = User.Variable(section,key)
dim i as integer = User.Variable(section,key)
dim b as boolean = User.Variable(section,key)

In wcBASIC, you can now access other sections in the extended user database in the same manner you could for the "profile" section of the extended user database.

The "Extended User Database" is basically similar to a registry system where you have Sections, Keys in Sections and values for each key, like so:

[profile]        <<<< section
key1=value1
key2=value2

[anothersection] <<<< section
key1=value1
key2=value2

In Wildcat!, we normally use the extended user database to add additional information for user records. wcBASIC offers easy access to the "profile" section using the User.Profile() and the SetUserProfile() commands.

For example:

SetUserProfile("fruit","apple")
...
dim fruit as string = user.profile("fruit")
print "your favorite fruit is: ";fruit

The data is stored in the [profile] section of the extended user database.

However, gaining access to the other sections required that you import the SDK functions GetUserVariable() and SetUserVariable() functions from the wcsrv.dll dynamic link library.

This isn't necessary anymore with the new commands:

User.Variable(section,key,defaultvalue)
SetUserVariable(section,key,value)

You would use these in the same manner as you did with profile, however now, you provide the name of the section as the first parameter to the commands.

For example:

SetUserVariable("MySection","Key1","Value1")
...
print "key1 = "; User.Variable("MySection","Key1")

Note: Whenever you update the extended user database, you must call UpdateUser() in order to commit the user data to disk.

© 2001 Hector Santos, http://www.santronics.com