See RegistryValues() in the PowerBuilder Help. The following isn't exactly what you want but it does show a couple of working calls...
integer li_RC
string ls_odbc_ini[]
li_RC = RegistryValues ( &
"HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\ODBC Data Sources", &
ls_odbc_ini )
IF li_RC <> 1 THEN
MessageBox ( 'Error', &
'RegistryValues failed in website.open' )
RETURN
END IF
MessageBox ( 'A user DSN...', ls_odbc_ini[1] )
li_RC = RegistryValues ( &
"HKEY_LOCAL_MACHINE\Software\ODBC\ODBC.INI\ODBC Data Sources", &
ls_odbc_ini )
IF li_RC <> 1 THEN
MessageBox ( 'Error', &
'RegistryValues failed in website.open' )
RETURN
END IF
MessageBox ( 'A system DSN...', ls_odbc_ini[1] )
Another suggestion is to read the connection information from whichever DSN you want, and then use a "DSN-less" connection, to avoid "picking the wrong DSN".
SQLCA.DBMS = 'ODB'
SQLCA.DBParm &
= "ConnectString='Driver=SQL Anywhere 10;" &
+ "UID=dba;PWD=sql;DatabaseName=ruralfinds_local;EngineName=ruralfinds_local'," &
+ "ConnectOption='SQL_DRIVER_CONNECT,SQL_DRIVER_NOPROMPT'"
CONNECT USING SQLCA;
IF SQLCA.SQLCODE <> 0 THEN
MessageBox ( 'Error', &
'CONNECT failed in open:' &
+ '~r~nSQLCode = ' &
+ String ( SQLCA.SQLCode ) &
+ '~r~nSQLDBCode = ' &
+ String ( SQLCA.SQLDBCode ) &
+ '~r~n' &
+ SQLCA.SQLErrText )
RETURN
END IF
Breck