Modify the of_GetConnectionInfo function
You looked at the of_GetConnectionInfo function in the last
exercise. Now you comment out the information that the function returns
for the user ID and password information.
If you closed the User Object painter, you must open it again for
the n_pbtutor_connectservice user object. You can use the File>Recent
Objects menu to redisplay it.
-
Select Functions in the first drop-down list box in the Script
view. -
Select of_GetConnectionInfo in the second drop-down list
box. -
Select the two ProfileString assignment lines that
begin:12as_userid = ProfileString (...)as_dbpass = ProfileString (...)The four arguments of a ProfileString call are the INI file
name or variable, the INI file section, the INI file key, and the
default value to be used if the INI file name, section, or key is
incorrect. These lines are part of the IS_USE_INIFILE case of the
CHOOSE CASE statement for the of_GetConnectionInfo function. -
Click the Comment button (
) in PainterBar2.By commenting out these lines, you make sure that the user ID
and password information do not come from the pbtutor.ini
file. -
Click anywhere in the line that begins:
1as_dbparm = ProfileString ( ... ) -
Click the Comment button in PainterBar2.
The DBParm parameter in the pbtutor.ini file includes
hard-coded values for the user ID and password as well as the
database name. You do not use these values. Instead, you assign
values to the DBParm parameter from user-entry information for user
ID and password.About the SQLCA DBParm parameter
Although the user ID and password are not required for the
DBParm ConnectString, assigning them to the ConnectString
overwrites SQLCA user ID and password values in the data source
definition for an SQL Anywhere database. For this DBMS, the DBParm
parameter also takes precedence over the SQLCA UserID and DBPass
parameters. -
Click the Save button in PainterBar1.
-
Click the Close button in PainterBar1.