Kbase P92233: How to connect to a database from 4GL using a .pf file and a user password that ends with the single
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  8/25/2004 |
|
Status: Unverified
GOAL:
How to connect to a database from 4GL using a .pf file and a user password that ends with the single quote character.
FIX:
/*
This procedure connects to the sports2000 demo database using a .pf file and a user password that ends with a single quote character.
The .pf file in this sample has the following line naming the database:
-db C:\WRK91D\sports2000
It is assumed that the database has been served to allow the multi-user mode connection performed in this sample.
note:
CHR(32) is the space character ' '.
CHR(34) is the double quote character: ".
CHR(39) is the single quote character: '.
*/
DEFINE VARIABLE pfFileName AS CHARACTER NO-UNDO.
DEFINE VARIABLE cUserid AS CHARACTER NO-UNDO.
DEFINE VARIABLE cUserPassword AS CHARACTER NO-UNDO.
DEFINE VARIABLE cConnectionString AS CHARACTER NO-UNDO.
ASSIGN
pfFileName = "myfile.pf"
cUserid = "singlequote"
cUserPassword = "123'"
cConnectionString =
"-pf" + CHR(32) + pfFileName + CHR(32) +
"-U" + CHR(32) +
CHR(34) + cUserid + CHR(32) + CHR(34) +
'-P' + CHR(32) + CHR(34) + cUserPassword + CHR(34).
MESSAGE cConnectionString
VIEW-AS ALERT-BOX INFO BUTTONS OK.
CONNECT VALUE(cConnectionString).